Fix test:watch requiring two saves to actually run the code/test you just changed

Will fix https://github.com/nativefier/nativefier/pull/1204#issuecomment-852155755
See package.json in comments for description
This commit is contained in:
Ronan Jouchet 2021-06-01 20:43:46 -04:00
parent 86a27d4f39
commit 9c5dba7f07
1 changed files with 8 additions and 0 deletions

View File

@ -84,6 +84,10 @@
"webpack": "^5.24.4",
"webpack-cli": "^4.5.0"
},
"jest_COMMENTS": {
"testPathIgnorePatterns": "See https://jestjs.io/docs/configuration#testpathignorepatterns-arraystring . We set it to 1. ignore coverage for deps, and 2. be sure we test the compiled JS, which is in `lib`, not `src`",
"watchPathIgnorePatterns": "See https://jestjs.io/docs/configuration#watchpathignorepatterns-arraystring . We set it for `jest --watch` (a.k.a. `npm run test:watch`) to trigger only after `tsc --watch` (a.k.a. `npm run build:watch`) completes its incremental compilation. Else, jest will pick up immediately on changes in `src` when TSC is barely running, hence testing not-recompiled-yet code and being super confusing, as 1. your changes won't be taken during this first run, and 2. the *next* run (e.g. after a second 'Save' in your editor) will actually have the new code :D"
},
"jest": {
"collectCoverage": true,
"setupFiles": [
@ -94,6 +98,10 @@
"/node_modules/",
"<rootDir>/app/src.*",
"<rootDir>/src.*"
],
"watchPathIgnorePatterns": [
"<rootDir>/app/src.*",
"<rootDir>/src.*"
]
},
"prettier": {