运行npm t -- --watch
未检测到对测试文件的更改。如果我运行npm t
或npm run test:changed
(我的脚本仅运行通过 覆盖更改的文件的测试jest -o
)一切正常,但是,不会检测到任何更改并且不会重新运行测试。
知道我做错了什么吗?
对于额外的上下文,我正在使用ts-jest
这里是我的一些相关配置文件:
src/tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"outDir": "../dist",
"esModuleInterop": true,
"noImplicitAny": true,
"noEmitOnError": true,
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"lib": ["esnext", "esnext.asynciterable"],
"emitDecoratorMetadata": true,
"experimentalDecorators": true
},
"include": ["./**/*.ts"],
"exclude": ["node_modules", "./**/*.test.ts"]
}
jest.config.ts
module.exports = {
globals: {
'ts-jest': {
tsConfig: 'src/tsconfig.json',
},
},
moduleFileExtensions: ['js', 'json', 'jsx', 'ts', 'tsx'],
roots: ['src'],
transform: {
'^.+\\.(ts|tsx)$': 'ts-jest',
},
testMatch: ['**/*.test.(ts|js)'],
testEnvironment: 'node',
preset: 'ts-jest',
collectCoverageFrom: ['./src/**/*.ts', '!./src/migration/**', '!./src/tests/**'],
coverageDirectory: './',
coverageThreshold: {
global: {
statements: 60,
branches: 45,
functions: 35,
lines: 60,
},
},
};