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