【发布时间】:2019-01-02 10:54:44
【问题描述】:
目前我正在使用标准的 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.
【问题讨论】:
-
谢谢@Paul,我尝试添加它(请参阅我在问题中的更新......找不到这样的例子......
标签: javascript jestjs testunit