Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C create-react-app
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 1,547
    • Issues 1,547
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 417
    • Merge requests 417
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Meta
  • create-react-app
  • Merge requests
  • !1659

Add overrideConfig option for the react-scripts test script

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/cjbuchmann/react-scripts-override-config into master Feb 27, 2017
  • Overview 4
  • Commits 2
  • Pipelines 0
  • Changes 3

Created by: cjbuchmann

Hey all, new contributor here. While I'm really enjoying all of the greatness that this project has to offer, I've run up against a few issues when it comes to testing that would be easily solved by adding my own jest configuration.

Unfortunately the jest configuration appears to be inaccessible to the user, so this branch attempts to allow the user the ability to configure this as needed. From what I understand, I could add my own config by ejecting the react-scripts, but that seems a little too heavy handed.

I also understand that this might go against the core value of 'convention over configuration', so if you'd prefer to avoid this approach, that's fine too.

In particular, I've been following along with jest not running tests inside of /src/node_modules. In my case, I'm also getting import errors SyntaxError: Unexpected token import during testing that is resolved by adding

  "transformIgnorePatterns": [
    "<rootDir>/(node_modules)/"
  ]

to the jest config. But I don't see any way of adding my own config options to the jest config at the present time. (If there is, I'd definitely appreciate that feedback).

Thanks!

Usage

you can define your own config options in a json file config.json

{
    "transformIgnorePatterns": [
    "<rootDir>/(node_modules)/"
  ]
}

You can then specify that json file in package.json

"test": "react-scripts test --env=jsdom  --overrideConfig=config.json",

the options will be merged with (and can override) the existing configuration options

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/cjbuchmann/react-scripts-override-config