I have a node js project and it have 2 test folders. There are app & admin folder inside of src/ test /v1. I want script to run test from only app folder. I tried using jest app
, jest app --testPathPattern=src/__test__/v1/app"
but both didn't worked.
By default jest will try to run all tests recursively of the root directory (where package.json is)
To specify a specific folder via CLI:
jest --testPathPattern=src/test/v1/app
You can also setup package.json to have specific test commands for running tests for specific folders:
"scripts": {
"test:app": "jest --testPathPattern=src/test/v1/app",
"test:admin": "jest --testPathPattern=src/test/v1/admin",
},
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.