Skip to content

Commit 8a1b362

Browse files
authored
enhance doc for v6 (#1066)
1 parent ad719cb commit 8a1b362

File tree

2 files changed

+26
-16
lines changed

2 files changed

+26
-16
lines changed

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ Content
6363
- [monitorLongRun](#monitorlongrun)
6464
- [autoRevealOutput](#autorevealoutput)
6565
- [parserPluginOptions](#parserpluginoptions)
66+
- [useDashedArgs](#usedashedargs)
6667
- [virtualFolders](#virtualfolders)
6768
- [Debug Config](#debug-config)
6869
- [Debug Config v2](#debug-config-v2)
@@ -252,19 +253,19 @@ Users can use the following settings to tailor the extension for their environme
252253
- settings marked with 💼 apply to the whole project, otherwise per workspace.
253254

254255

255-
|setting|description|default|example/notes|
256-
|---|---|---|---|
256+
|setting|description|default|example/notes|available since|
257+
|---|---|---|---|---|
257258
|**Process**|
258-
|enable|Enable/disable jest extension for the given workspace folder/virtual-folder|true|`"jest.enable": false`|
259+
|enable|Enable/disable jest extension for the given workspace folder/virtual-folder|true|`"jest.enable": false`| >= v6.0.0|
259260
|[jestCommandLine](#jestcommandline)|The command line to start jest tests|undefined|`"jest.jestCommandLine": "npm test --"` or `"jest.jestCommandLine": "yarn test"` or `"jest.jestCommandLine": "node_modules/.bin/jest --config custom-config.js"`|
260261
|nodeEnv|Add additional env variables to spawned jest process|null|`"jest.nodeEnv": {"PORT": "9800", "BAR":"true"}` |
261-
|[shell](#shell)|shell (path or LoginShell) for executing jest|null|`"jest.shell": "/bin/bash"` or `"jest.shell": "powershell"` or `"jest.shell": {"path": "/bin/bash"; args: ["--login"]}` |
262-
|[autoRun](#autorun)|Controls when and what tests should be run|undefined|`"jest.autoRun": "off"` or `"jest.autoRun": "watch"` or `"jest.autoRun": {"watch": false, "onSave":"test-only"}`|
263-
|[rootPath](#rootPath)|The path to your frontend src folder|""|`"jest.rootPath":"packages/app"` or `"jest.rootPath":"/apps/my-app"`|
264-
useDashedArgs| Determine if to use dashed arguments for jest processes |undefined|`"jest.useDashedArgs":true`|
265-
|[monitorLongRun](#monitorlongrun)| monitor long running tests based on given threshold in ms|60000|`"jest.monitorLongRun": 120000`|
266-
|[parserPluginOptions](#parserpluginoptions)|Configure babel parser plugins|null|`"jest.parserPluginOptions": {decorators: 'legacy'}`|
267-
|[virtualFolders](#virtual-folders)|defines multiple jest runs in a given vscode workspace folder|undefined|`"jest.virtualFolders": "[{"name": "front-end", "rootPath': "packages/front-end"}, {"name": "back-end", "rootPath': "packages/back-end"} ]"`|
262+
|[shell](#shell)|shell (path or LoginShell) for executing jest|null|`"jest.shell": "/bin/bash"` or `"jest.shell": "powershell"` or `"jest.shell": {"path": "/bin/bash"; args: ["--login"]}` ||
263+
|[autoRun](#autorun)|Controls when and what tests should be run|undefined|`"jest.autoRun": "off"` or `"jest.autoRun": "watch"` or `"jest.autoRun": {"watch": false, "onSave":"test-only"}`||
264+
|[rootPath](#rootPath)|The path to your frontend src folder|""|`"jest.rootPath":"packages/app"` or `"jest.rootPath":"/apps/my-app"`||
265+
[useDashedArgs](#usedashedargs)| Determine if to use dashed arguments for jest processes |undefined|`"jest.useDashedArgs":true`| >= v6.0.0 |
266+
|[monitorLongRun](#monitorlongrun)| monitor long running tests based on given threshold in ms|60000|`"jest.monitorLongRun": 120000`||
267+
|[parserPluginOptions](#parserpluginoptions)|Configure babel parser plugins|null|`"jest.parserPluginOptions": {decorators: 'legacy'}`||
268+
|[virtualFolders](#virtual-folders)|defines multiple jest runs in a given vscode workspace folder|undefined|`"jest.virtualFolders": "[{"name": "front-end", "rootPath': "packages/front-end"}, {"name": "back-end", "rootPath': "packages/back-end"} ]"`| >= v6.0.0|
268269
|**Editor**|
269270
|[testExplorer](#testexplorer) |Configure jest test explorer|null|`{"showInlineError": "true"}`|
270271
|**Coverage**|
@@ -275,7 +276,7 @@ useDashedArgs| Determine if to use dashed arguments for jest processes |undefine
275276
|debugMode|Enable debug mode to diagnose plugin issues. (see developer console)|false|`"jest.debugMode": true`|
276277
|disabledWorkspaceFolders 💼|Disabled workspace folders names in multi-root environment|[]|`"jest.disabledWorkspaceFolders": ["package-a", "package-b"]`|
277278
|[autoRevealOutput](#autoRevealOutput)|Determine when to show test output|"on-run"|`"jest.autoRevealOutput": "on-exec-error"`|
278-
|autoClearTerminal|Clear the terminal output at the start of any new test run.|false|`"jest.autoClearTerminal": true`|
279+
|autoClearTerminal|Clear the terminal output at the start of any new test run.|false|`"jest.autoClearTerminal": true`| >= v6.0.0 |
279280

280281
#### Details
281282
##### jestCommandLine
@@ -469,6 +470,14 @@ This extension uses babel to parse the test files. For decorators [plugin option
469470

470471
"jest.parserPluginOptions": {"decorators": {"decoratorsBeforeExport": false}}
471472
```
473+
474+
##### useDashedArgs
475+
If true, use dashed arguments for spawned jest processes.
476+
477+
Please bear in mind that you might encounter compatibility issue with other tools/systems. For instance, we've identified an issue in react-script where `"watch-all"=false` (an argument the extension appended) isn't recognized (see [facebook/react-script#12801](https://github.com/facebook/create-react-app/issues/12801) for more details). Please report them if you encounter any.
478+
479+
Also note this flag does not apply to debug config, which can be changed manually since the [debug config v2](#debug-config-v2) was introduced a while back.
480+
472481
##### virtualFolders
473482

474483
Much like a vscode workspace folder, which manages a runtime environment for a specific folder, a virtualFolder manages a custom Jest runtime environment. Each virtualFolder can have its own resource-level [settings](#settings), such as `jestCommandLine` and `rootPath`.
@@ -531,6 +540,7 @@ However, there are some key differences between virtual folders and multi-root w
531540
5. virtualFolders only contains jest settings. If your project require non-jest settings from the package's own `.vscode/settings.json` (like in a multi-root workspace), then you are probably better off continue with multi-root workspace.
532541

533542

543+
534544
### Debug Config
535545

536546
This extension looks for jest specific debug config (`"vscode-jest-tests.[folder-name]"` or `"vscode-jest-tests.v2.[folder-name]"`) in the following order:

release-notes/release-note-v6.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ This major release introduces the 'Virtual Folders' feature. Much like a VSCode
2121
### Main Features
2222
#### 1. Virtual Folders
2323

24-
Supporting multiple jest configs is a common use cases for monorepo projects and projects with multiple test environments, such as unit and integration tests. We introduced monorepo support with vscode multi-root workspaces a few years ago. While it works well for most use cases, it fell short for multi-test-environment that share the same code base (folder). This version will close this gap with the [Virtual Folders](README.md#virtualfolders).
24+
Supporting multiple jest configs is a common use cases for monorepo projects and projects with multiple test environments, such as unit and integration tests. We introduced monorepo support with vscode multi-root workspaces a few years ago. While it works well for most use cases, it fell short for multi-test-environment that share the same code base (folder). This version will close this gap with the [Virtual Folders](https://github.com/jest-community/vscode-jest#virtualfolders).
2525

2626
For example, the unit vs. integration tests can now be set up as the following:
2727
```json
@@ -53,7 +53,7 @@ And yes you can indeed use virtual folders with monorepo projects. For example,
5353
}
5454
```
5555

56-
So when to use multi-root workspaces vs. virtual folders? In short, if you created a multi-root workspace simply for running different jest config - you could probably just use `"jest.virtualFolders"` instead. If you do require different non-jest vscode settings for each folder, continue to use multi-root workspace. More details in [Virtual Folders](README.md#virtualfolders).
56+
So when to use multi-root workspaces vs. virtual folders? In short, if you created a multi-root workspace simply for running different jest config - you could probably just use `"jest.virtualFolders"` instead. If you do require different non-jest vscode settings for each folder, continue to use multi-root workspace. More details in [Virtual Folders](https://github.com/jest-community/vscode-jest#virtualfolders).
5757

5858

5959
- [#1035](https://github.com/jest-community/vscode-jest/pull/1035) - @connectdotz
@@ -64,7 +64,7 @@ In light of Angular's decision to drop support for CamelCase arguments, we've be
6464

6565
However, bear in mind that you might encounter compatibility issue with other tools/systems. For instance, we've identified an issue in react-script where `"watch-all"=false` (an argument the extension appended) isn't recognized (see facebook/react-script#12801 for more details). Please report them if you encounter any.
6666

67-
See [Customization](README.md#customization) for more details.
67+
See [useDashedArgs](https://github.com/jest-community/vscode-jest#usedashedargs) for more details.
6868

6969

7070
<!-- cSpell:ignore mjamin -->
@@ -76,15 +76,15 @@ A new setting`"jest.enable"` is added as a quick way to turn off the extension f
7676

7777
This is indeed similar to `"jest.disabledWorkspaceFolders"`, which is a "window" level setting (on the root of the workspace). Given the target is the folder itself, we believe it makes more sense to put the control `"jest.enable"` in folder level instead. It could also provide better extensibility down the road, such as "deferred-activation". We hope `"jest.enable"` will eventually replace `"jest.disabledWorkspaceFolders"`.
7878

79-
See [Customization](README.md#customization) for more details.
79+
See [Customization](https://github.com/jest-community/vscode-jest#customization) for more details.
8080

8181
- [#1009](https://github.com/jest-community/vscode-jest/pull/1009) - @connectdotz
8282

8383
#### 4. Auto clear output upon test run
8484

8585
Introduced a new setting - `"jest.autoClearOutput"` - to clear the output terminal before each test run. Default is false for backward compatibility. This is useful when you want to see only the last run output.
8686

87-
See [Customization](README.md#customization) for more details.
87+
See [Customization](https://github.com/jest-community/vscode-jest#customization) for more details.
8888

8989
<!-- cSpell:ignore jgillick -->
9090
- [#1014](https://github.com/jest-community/vscode-jest/pull/1014) - @jgillick

0 commit comments

Comments
 (0)