'jest.config is being ignored
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"
},
Solution 1:[1]
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
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Robin Michay |
Solution 2 | ItsIgzy |