作者:天黑丶請脱衣 | 来源:互联网 | 2023-02-01 17:31
我最近从摩卡咖啡转到了Jest。除了始终运行所有测试的监视模式以外,其他所有功能都正常运行(不仅是文档中所说的与未提交文件相关的测试)。我已经搜索了文档,并使用了google,但没有找到有关此问题的任何信息。
我开玩笑的配置是
"jest": {
"coveragePathIgnorePatterns": [
"/node_modules/",
"/generated/",
"/mock/",
"/tools/",
"/transactions/"
],
"coverageThreshold": {
"global": {
"branches": 90,
"functions": 90,
"lines": 90,
"statements": 90
}
},
"resetMocks": true,
"moduleDirectories": [
"node_modules",
"src"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/src/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "/src/__mocks__/styleMock.js"
},
"setupTestFrameworkScriptFile": "/tools/setupTest.js"
},
该setupTestFrameworkScriptFile
只包含一行:
require('babel-polyfill');
Babelrc:
"env": {
"test": {
"plugins": [
"rewire",
"transform-class-properties",
"transform-es2015-modules-commonjs"
],
"presets": [
"es2017",
"react",
"stage-0",
"es2015"
]
}
}
我从开始测试,jest --watch
并显示消息“确定要运行的测试套件”,但是即使没有提交任何文件,也将运行所有测试。
我在Windows 7上,并且在powershell中运行命令。节点版本:v6.9.1
Jest版本:"babel-jest": "20.0.3"
,"jest": "20.0.4"