Reputation: 8685
I have the following in my jest.config.js
module.exports = {
preset: 'ts-jest/presets/js-with-ts',
testEnvironment: 'jsdom'
};
but it's being ignored when I run npm test. Can someone please help?
Here's my package.json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
Upvotes: 3
Views: 10363
Reputation: 445
Have in mind that you are probablly overriding the defaults so you need to make a require as stated in the documentation Jest Documentation scroll to defaults
Just making a module.exports isn't enough.
Upvotes: 0
Reputation: 817
Seems like adding -- --config=jest.config.js
is enough.
You can try to replace the scripts "test" in package.json by react-scripts test -- --config=jest.config.js
, else you can set the jest config directly into the package.json
You can find the answer here : How to use jest.config.js with create-react-app
Upvotes: 3