我在gitlab作业中有以下输出:
yarn run v1.15.2
$ jest --verbose
No tests found
In /path/to/my/project/
47 files checked.
testMatch: - 47 matches
testPathIgnorePatterns: /node_modules/,/build,/lib/ - 0 matches
testRegex: (/__tests__/.*|\.(test|spec))\.(tsx?|jsx?)$ - 1 match
Pattern: - 0 matches
测试没有被执行,我在这里做错了什么?我一直在其他项目中使用相同的gitlab-ci.yml配置。
任何帮助,将不胜感激!
是的,错误在package.json中,我在testPathIgnorePatterns中缺少<rootDir>,在jest选项下缺少modulePathIgnorePatterns路径。
"testPathIgnorePatterns": [
"<rootDir>/node_modules/",
"<rootDir>/build",
"<rootDir>/lib/"
],
"modulePathIgnorePatterns": [
"<rootDir>/dist/",
"<rootDir>/build/"
]
错误在你的道路上。首先打开你的cmd
并导航到你的package.json
所在的目录,然后确保你在package.json
提供的任何路径,它必须得到。
您也可以尝试对路径进行硬编码。一旦你能够运行它然后去正则表达式。
package.json
"name": "test",
"jest": {
"transform": {},
"verbose": true,
"bail": true,
"testMatch": ["path"]
},
有关更多详细信息:testPathIgnorePatterns,modulePathIgnorePatterns
"testPathIgnorePatterns": [
"<rootDir>/build"
],
"modulePathIgnorePatterns": [
"<rootDir>/build/"
]