In a create-react-app application, I have named a source file :
/src/config/env/test.js
Unfortunately, jest is now trying to execute it as a test,
I have tried to add the following in my package.json
:
"jest": {
"collectCoverageFrom": [
"!<rootDir>/src/config/env/test.js",
"!<rootDir>/node_modules/"
]
}
But I still have this error:
FAIL src/config/env/test.js
● Test suite failed to run
Your test suite must contain at least one test.
at node_modules/jest/node_modules/jest-cli/build/TestScheduler.js:256:22
I am using react-scripts 2.1.3
The simplest solution here would be using the testPathIgnorePatterns
configuration value, like this:
"testPathIgnorePatterns": ["\/test.js"]