Add overrideConfig option for the react-scripts test script #1659
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 errorsSyntaxError: Unexpected token import
during testing that is resolved by addingto 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
You can then specify that json file in
package.json
the options will be merged with (and can override) the existing configuration options