More test:watch fixes & usability

See https://github.com/nativefier/nativefier/pull/1204#issuecomment-852679403
This commit is contained in:
Ronan Jouchet 2021-06-01 23:37:04 -04:00
parent 9c5dba7f07
commit 6b09d1467f
2 changed files with 13 additions and 6 deletions

View File

@ -1,5 +1,7 @@
const path = require('path');
// Q: Why do you use webpack?
// A: https://github.com/nativefier/nativefier/commit/cde5c1e13bdc2739604cab04bac64eae0d719ed1
module.exports = {
target: 'node',
entry: './src/main.ts',

View File

@ -34,7 +34,7 @@
"build-app": "cd app && webpack",
"build-app-static": "ncp app/src/static/ app/lib/static/ && ncp app/dist/preload.js app/lib/preload.js && ncp app/dist/preload.js.map app/lib/preload.js.map",
"build": "npm run clean && tsc --build . app && npm run build-app && npm run build-app-static",
"build:watch": "tsc --build . app --watch",
"build:watch": "npm run clean && tsc --build . app --watch",
"changelog": "./.github/generate-changelog",
"ci": "npm run lint && npm test",
"clean": "rimraf lib/ app/lib/ app/dist/",
@ -47,7 +47,7 @@
"test:integration": "jest --testRegex '.*integration-test.js'",
"test:manual": "npm run build && ./.github/manual-test",
"test:unit": "jest",
"test:watch": "echo 'Remember to run npm run build:watch for the test watcher to work!' && jest --watch",
"test:watch": "echo 'Remember to run npm run build:watch for the test watcher to work!' && jest --watchAll --collectCoverage=false",
"test:withlog": "LOGLEVEL=trace npm run test",
"test": "jest --testRegex '[-.]test\\.js$'",
"watch": "npx concurrently \"npm:*:watch\""
@ -85,7 +85,7 @@
"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`",
"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` or `dist`",
"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": {
@ -95,13 +95,18 @@
],
"testEnvironment": "node",
"testPathIgnorePatterns": [
"/node_modules/",
"<rootDir>/src.*",
"<rootDir>/node_modules.*",
"<rootDir>/app/src.*",
"<rootDir>/src.*"
"<rootDir>/app/dist.*",
"<rootDir>/app/node_modules.*"
],
"watchPathIgnorePatterns": [
"<rootDir>/src.*",
"<rootDir>/tsconfig.json",
"<rootDir>/app/src.*",
"<rootDir>/src.*"
"<rootDir>/app/dist.*",
"<rootDir>/app/tsconfig.json"
]
},
"prettier": {