-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
We have an angular project using jest. Jest uses git to determine file changes and run tests against these files.
Clean project
If the project is "clean" with no change since last commit, then running jest --watch starts properly. Then we can use it normally, it detects changes properly and run expected tests suits.
Dirty project
if the projects has changes on certain files since last commit and we try to run jest --watch then Jest struggles to start and stay forever on the Determining test suites to run... state. Any change after that doesn't change the stuck jest state.
If we revert our changes (nothing to be commited) then retry to launch jest --watch works. So it seems it's a real problem with git changes detection by Jest.
Environment
This behavior is always encountered on windows. And sometimes on mac OS.
What is the expected behavior?
Being able to run jest --watch even if there are modified files since last commit. If the changes files are not detected properly we expect to be able to even load jest and being able to pattern filter on the files we want.
Please provide your exact Jest configuration
module.exports = {
setupTestFrameworkScriptFile: "<rootDir>/src/setupJest.ts",
globals: {
'ts-jest': {
'tsConfigFile': 'src/tsconfig.spec.json'
},
'__TRANSFORM_HTML__': true
},
transform: {
'^.+\\.(ts|js|html)$': '<rootDir>/node_modules/jest-preset-angular/preprocessor.js',
},
testMatch: [
"**/__tests__/**/*.+(ts|js)?(x)",
"**/+(*.)+(spec).+(ts|js)?(x)"
],
moduleFileExtensions: [
'ts',
'js',
'html'
],
moduleNameMapper: {
"assets/(.*)": "<rootDir>/src/assets/$1"
},
transformIgnorePatterns: [
'node_modules/(?!@ngrx)'
],
coverageReporters: ['html', 'text-summary', 'text']
};
Run npx envinfo --preset jest in your project directory and paste the
results here
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Binaries:
Yarn: 1.6.0 - C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 5.8.0 - C:\Program Files\nodejs\npm.CM
System:
OS: macOS High Sierra 10.13.4
CPU: x64 Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
Binaries:
Node: 8.11.1 - /usr/local/bin/node
Yarn: 1.6.0 - /usr/local/bin/yarn
npm: 5.6.0 - /usr/local/bin/npm
npmPackages:
@types/jest: 22.2.3 => 22.2.3
jest: 22.4.3 => 22.4.3