当前,我正在使用标准的testRegex逻辑来运行测试
"jest": {
"moduleFileExtensions": [
"ts",
"js"
],
"transform": {
"^.+\\.ts?$": "<rootDir>/node_modules/ts-jest/preprocessor.js",
"^.+\\.js?$": "babel-jest"
},
"testRegex": "/tests/.*\\.(ts|js)$"
}
但是我想使用特定的路径来分割它们
test-client "testRegex": "/tests/client/.*\\.(ts|js)$"
test-server "testRegex": "/tests/server/.*\\.(ts|js)$"
我看到有一个--runTestsByPath选项。但我找不到任何例子
欢迎反馈
更新
我尝试添加脚本
"test-client": "jest --runTestsByPath \"tests/client/\""
带有测试文件:tests / client / test.spec.js
但出现错误:
$ jest --runTestsByPath "tests/client/"
No tests found
No files found in /Users/../myapp.
Make sure Jest's configuration does not exclude this directory.
答案 0 :(得分:1)
答案 1 :(得分:0)
jest someDirectory --collectCoverageFrom = / someDirectory / / *。js