I am able to test each file using Jest, but I cannot figure out how to test multiple test files from separate folders. I have a folder named test and it has 2 sub folders: e2e and unit. I have these scripts to run these tests individually:
"test": "jest",
"test:e2e": "jest --config ./test/e2e/jest-e2e.json",
"test:unit": "jest --config ./test/unit/jest-unit.json"
When I run npm test
it only runs the spec
file inside the src
directory.
Also other 2 scripts runs the tests inside e2e and unit respectively.
Is there a way to run all of these tests with one script only?
You can change the folder name to __tests__
or add a jest.config.js
at the repo root with a testMatch
like this
testMatch: [
'**/test/**/*.js'
]