我希望结合cli和jest.config.js运行jest,所以我可以使用相同的配置,但在运行时进行一些小的更改。
jest --config=jest.config.js结果在
Test Suites: 1 failed, 163 passed, 164 total
Tests: 8 skipped, 1685 passed, 1693 total
Snapshots: 87 passed, 87 total
Time: 34.719s, estimated 44s而
jest --config=jest.config.js --testPathIgnorePatterns=[ignore]结果在
752 files checked.
testMatch: **/__tests__/**/*.[jt]s?(x), **/?(*.)+(spec|test).[tj]s?(x) - 164 matches
testPathIgnorePatterns: [ignore] - 0 matches
testRegex: - 0 matches
Pattern: - 0 matches
error Command failed with exit code 1.如果我修改配置
modulePathIgnorePatterns: [
'<rootDir>/src/.*/__mocks__',
'<rootDir>/node_modules',
'<rootDir>/.*/ignore',
],结果在
Test Suites: 163 passed, 163 total
Tests: 8 skipped, 1685 passed, 1693 total
Snapshots: 87 passed, 87 total
Time: 31.417s发布于 2020-08-13 13:20:23
文档声明testPathIgnorePatterns是一个数组。shell中的数组是逗号或空格分隔的。
这样做是可行的:
jest --config=jest.config.js --testPathIgnorePatterns=ignore如:
jest --config=jest.config.js --testPathIgnorePatterns=ignore,ignoreThisAsWellhttps://stackoverflow.com/questions/63395458
复制相似问题