This is my scripts section and jest section in my package.json
:
<code>...
"scripts": {
"start": "chmod +x ./env.sh && bash ./env.sh && cp env-config.js ./public/ && rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test setupFile ./src/setupTests.js",
"test-coverage": "react-scripts test setupFile ./src/setupTests.js --coverage",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.js --max-warnings=0"
},
"jest": {
"transform": {
"^.+\.(ts|tsx)$": "ts-jest"
},
"moduleNameMapper": {
"\.(css|less|sass|scss)$": "identity-obj-proxy"
},
"transformIgnorePatterns": [
"/node_modules/(?!(@ssce/ui-shared-library)/).*/"
]
},
...
</code>
<code>...
"scripts": {
"start": "chmod +x ./env.sh && bash ./env.sh && cp env-config.js ./public/ && rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test setupFile ./src/setupTests.js",
"test-coverage": "react-scripts test setupFile ./src/setupTests.js --coverage",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.js --max-warnings=0"
},
"jest": {
"transform": {
"^.+\.(ts|tsx)$": "ts-jest"
},
"moduleNameMapper": {
"\.(css|less|sass|scss)$": "identity-obj-proxy"
},
"transformIgnorePatterns": [
"/node_modules/(?!(@ssce/ui-shared-library)/).*/"
]
},
...
</code>
...
"scripts": {
"start": "chmod +x ./env.sh && bash ./env.sh && cp env-config.js ./public/ && rimraf ./build && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test setupFile ./src/setupTests.js",
"test-coverage": "react-scripts test setupFile ./src/setupTests.js --coverage",
"eject": "react-scripts eject",
"lint": "eslint src/**/*.js --max-warnings=0"
},
"jest": {
"transform": {
"^.+\.(ts|tsx)$": "ts-jest"
},
"moduleNameMapper": {
"\.(css|less|sass|scss)$": "identity-obj-proxy"
},
"transformIgnorePatterns": [
"/node_modules/(?!(@ssce/ui-shared-library)/).*/"
]
},
...
Whenever I run npm run test
I get this error:
No tests found, exiting with code 0
But we have tests, so I don’t understand why it can’t find them. Pressing “a” runs all tests successfully.
If I run an individual test npm run test test.test.js
it works fine.
How do I get my npm run test
to run all tests?