Skip to content

Commit

Permalink
chore: Add test:watch command
Browse files Browse the repository at this point in the history
vscode originally does not support watch mode, but apparently it's partly possible with jest runner
  • Loading branch information
svsool committed Aug 1, 2020
1 parent d825e8e commit 49f6ba4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ Guidelines enforced via commit hooks, so commits MUST be prefixed with a type.
## Run tests

```
yarn test
yarn test # runs all tests
yarn test:watch # runs only changed tests, consider also using JEST_TEST_REGEX env var for running specific tests
```

*Note: Before running integration tests, please ensure that all VSCode instances are closed.*
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@
"pretest": "tsc -p ./ && yarn run webpack --mode development",
"release": "standard-version",
"ts": "tsc --noEmit",
"test": "node ./out/test/runTest.js"
"test": "node ./out/test/runTest.js",
"test:watch": "cross-env JEST_WATCH=true node ./out/test/runTest.js"
},
"devDependencies": {
"@commitlint/cli": "^9.1.1",
Expand All @@ -154,6 +155,7 @@
"@types/vscode": "^1.47.0",
"@typescript-eslint/eslint-plugin": "^3.7.1",
"@typescript-eslint/parser": "^3.7.1",
"cross-env": "^7.0.2",
"eslint": "^7.5.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
Expand Down
1 change: 1 addition & 0 deletions src/test/testRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function run(): Promise<void> {
tsConfig: path.resolve(rootDir, './tsconfig.json'),
},
}),
watch: process.env.JEST_WATCH === 'true',
},
[rootDir],
);
Expand Down
9 changes: 8 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2236,6 +2236,13 @@ create-hmac@^1.1.0, create-hmac@^1.1.4, create-hmac@^1.1.7:
safe-buffer "^5.0.1"
sha.js "^2.4.8"

cross-env@^7.0.2:
version "7.0.2"
resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.2.tgz#bd5ed31339a93a3418ac4f3ca9ca3403082ae5f9"
integrity sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==
dependencies:
cross-spawn "^7.0.1"

cross-path-sort@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/cross-path-sort/-/cross-path-sort-1.0.0.tgz#9c07df9fe5ebdc49d980d99ffcf845f7717865b8"
Expand All @@ -2252,7 +2259,7 @@ cross-spawn@^6.0.0, cross-spawn@^6.0.5:
shebang-command "^1.2.0"
which "^1.2.9"

cross-spawn@^7.0.0, cross-spawn@^7.0.2:
cross-spawn@^7.0.0, cross-spawn@^7.0.1, cross-spawn@^7.0.2:
version "7.0.3"
resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==
Expand Down

0 comments on commit 49f6ba4

Please sign in to comment.