运行jest时,试图确定此错误的来源:
TypeError: (0 , (_jestUtil || _load_jestUtil(...)).validateCLIOptions) is not a function
我的目录结构:
root
-test
--spec-files
---*.js
我的软件包中的开发依赖项:
"devDependencies": {
"babel-eslint": "6.1.2",
"babel-jest": "22.1.0",
"chai": "3.5.0",
"chai-as-promised": "5.3.0",
"eslint": "2.13.1",
"eslint-config-airbnb": "6.2.0",
"eslint-plugin-react": "4.3.0",
"jest": "22.1.4",
"jest-cli": "22.1.4",
"jest-runner-eslint": "0.4.0",
"nodemon": "1.12.1",
"nyc": "11.2.1",
"sinon": "2.4.1",
"snyk": "1.69.10",
"spec-xunit-file": "0.0.1-3",
"supertest": "1.2.0",
"supertest-as-promised": "3.2.0",
"xunit-file": "0.0.9"
}
开玩笑配置。js:
module.exports = {
estPathIgnorePatterns: [
'<rootDir>/bower_components/',
'<rootDir>/node_modules/',
'<rootDir>/gulp-tasks/',
],
testMatch: ['<rootDir>/test/spec-files/*.js'],
globalSetup: '<rootDir>/test/setup.js',
};
正在运行:
./node_modules/.bin/jest --testPathPattern=test/spec-files/.*\\.js$
我只注意到一个与这类错误相关的问题:
https://github.com/facebook/jest/issues/5740
原因似乎是testPathPattern无效,但对我来说似乎不是这样。