You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+20-18
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ This extension supports full [jest](https://jestjs.io/) features in vscode envir
13
13
14
14
If the extension can find the jest command, by default it will automatically run and monitor all tests in watch mode upon launch, and you should see tests, status, errors, coverage (if enabled) in TestExplorer and editors like this:
15
15
16
-

16
+

17
17
18
18
If you have a more sophisticated project configuration or prefer to run tests differently, fear not, the extension supports extensive [customization settings](#customization). For example:
19
19
@@ -26,9 +26,9 @@ You can see the full [features](#features) and learn more details in the [How-To
* Starts Jest automatically for most projects with runnable jest configurations.
89
+
* Supports monorepo, react, react-native, angular, vue and various configurations/platforms.
90
+
* Supports running multiple jest processes within the same workspace folder.
89
91
* Fully integrated with the vscode TestExplorer.
92
+
* Help debug jest tests in vscode.
93
+
* View and update snapshots interactively.
94
+
* Show coverage information in files being tested.
90
95
* Supports both automatic and manual test runs at any level, and easy-switch via UI.
91
96
* Supports additional IntelliSense for jest methods.
92
97
* Show fails inline of the `expect` function, as well as in the problem inspector.
93
-
* View and update snapshots interactively.
94
-
* Help debug jest tests in vscode.
95
-
* Show coverage information in files being tested.
96
-
* Supports monorepo, react, react-native, angular, vue and various configurations/platforms.
97
-
* Supports running multiple jest processes from the same workspace folder.
98
98
* active community support.
99
99
100
100
## Installation
@@ -117,13 +117,13 @@ This extension fully integrates with the VSCode testing framework, supporting bo
117
117
We realized that runMode preference could change even within a given project, for example developers prefer "watch" runMode when doing light code changes to ensure nothing breaks, may prefer the 'on-demand' mode during heavy test development for greater control over test execution. A static runMode config in "settings.json" is simply not sufficient. Therefore, we added the [runMode quick switch](#runmode-chooser) so users can easily switch to different runMode without permanently modifying the "settings.json".
118
118
<br>
119
119
120
-
2.**Interactive Test Run**: Besides automatic test executions ("watch", "on-save"), users can initiate full test actions, such as run, debug, [update/view snapshot](#how-to-update-and-view-snapshots), from both editor and Test Explorer through various [UI components](#how-to-trigger-the-test-run).
120
+
2.**Interactive Test Run**: Besides automatic test executions ("watch", "on-save"), users can initiate full test actions, such as run, debug, [update/view snapshot](#how-to-update-and-view-snapshots), from both editor and Test Explorer through various [UI components](#how-to-trigger-a-test-run).
121
121
<br>
122
122
123
123
3.**Test Output**: The extension offers native jest run outputs in both the "TERMINAL" and "TEST RESULTS" panel. "TEST RESULTS" panel mainly displays test run output in execution order, while "TERMINAL" groups test output by workspace folder/virtual-folder, and also includes extension configuration details, [quick-fix](#quick-fix-chooser) suggestions, etc. By default, the output appears when tests run, but this can be adjusted via the [outputConfig](#outputconfig) setting.
124
124
<br>
125
125
126
-
4.**Extension Status**: Upon successful launch of the extension, the [status bar](#how-to-trigger-the-test-run) shows the run status for the active folder, and the aggregated test status for the whole workspace. Clicking on each status reveals the associated output window.
126
+
4.**Extension Status**: Upon successful launch of the extension, the [status bar](#how-to-read-the-statusbar) shows the run status for the active folder, and the aggregated test status for the whole workspace. Clicking on each status reveals the associated output window.
127
127
128
128
## How To?
129
129
### How to set up the extension?
@@ -176,14 +176,14 @@ The extension will try to generate a debug config, but if you encounter a debug
176
176
### How to use code coverage?
177
177
178
178
Code coverage can be triggered via
179
-
1. change [runMode](#runmode) config via [chooser](#run-modoe-chooser) or settings.
179
+
1. change [runMode](#runmode) config via [chooser](#runmode-chooser) or settings.
180
180
2.[Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette), select command like **Jest: Toggle Coverage** to activate or deactivate code coverage (see full list in [commands](#commands).
181
181
182
182
The coverage stats will be displayed at the source code editor: summary at the top and inline coverage indicator based on the formatter selected.
To verify the coverage mode is on, one can check the [runMode chooser](#run-mode-choose) or the status bar (see [how to read the status bar](#how-to-read-the-statusbar))
186
+
To verify the coverage mode is on, one can check the [runMode chooser](#runmode-chooser) or the status bar (see [how to read the status bar](#how-to-read-the-statusbar))
187
187
188
188
Note: this extension supports both `babel` and `v8` coverageProviders. However, please note the coverage might not be exactly the same, see [facebook/jest#11188](https://github.com/facebook/jest/issues/11188) for more details.
189
189
@@ -348,7 +348,7 @@ for example:
348
348
349
349
#### outputConfig
350
350
351
-
The `outputConfig` controls the Jest output experience by specifying when and where to create, display, and clear the output content. It supports 2 output panels: `TEST RESULTS` and `TERMINAL`. The `TEST RESULTS` panel displays test results in the order they were run, while the `TERMINAL` panel organizes outputs by workspace folder. `TERMINAL` panel also contains the non-test run outputs, such as [quick-fix link](quick-fix-chooser), extension auto-config info and tips.
351
+
The `outputConfig` controls the Jest output experience by specifying when and where to create, display, and clear the output content. It supports 2 output panels: `TEST RESULTS` and `TERMINAL`. The `TEST RESULTS` panel displays test results in the order they were run, while the `TERMINAL` panel organizes outputs by workspace folder. `TERMINAL` panel also contains the non-test run outputs, such as [quick-fix link](#quick-fix-chooser), extension auto-config info and tips.
352
352
353
353
**Type Definitions**
354
354
```ts
@@ -556,8 +556,8 @@ While the concepts of performance and automation are generally clear, "completen
556
556
3. Tests bearing dynamic names, like those using test.each with variables or template literals, won't be translated. As a result, they must be executed through higher-level constructs, such as describe blocks with static names or entire test suites.
557
557
558
558
559
-
**Migration Guide**
560
559
<aid="runmode-migration"></a>
560
+
**Migration Guide**
561
561
Starting from v6.1.0, if no runMode is defined in settings.json, the extension will automatically generate one using legacy settings (`autoRun`, `showCoverageOnLoad`). To migrate, simply use the `"Jest: Save Current RunMode"` command from the command palette to update the setting, then remove the deprecated settings.
562
562
563
563
---
@@ -579,7 +579,7 @@ Performance and automation are self-explanatory, "completeness" might not:
579
579
3. tests with dynamic names (test.each with variables, template-literals, etc.) will not be translated; therefore, they can only be run through parent blocks (describe-with-static-name or test suite, etc.).
580
580
581
581
There are 2 ways to change autoRun:
582
-
1. Temporarily [toggle autoRun on/off in TestExplorer](#how-to-toggle-auto-run)
582
+
1. Temporarily toggle autoRun on/off in TestExplorer
@@ -609,7 +609,7 @@ There are 2 ways to change autoRun:
609
609
<details>
610
610
<summary>example</summary>
611
611
612
-
- Turn off auto run, users need to trigger tests run manually via [run commands](#commands-run) and [menus](#context-menu):
612
+
- Turn off auto run, users need to trigger tests run manually via run commands or contextmenu:
613
613
```json
614
614
"jest.autoRun": "off"
615
615
```
@@ -677,7 +677,8 @@ By default, jest command is executed in default shell ('cmd' for windows, '/bin/
677
677
Note the LoginShell is only applicable for non-windows platform and could cause a bit more overhead.
678
678
679
679
<aid="auto-recovery-login-shell"></a>
680
-
_Note_: Since v5, if detected shell env issue, such as `node: command not found` or `npm: no such file or directory`, the extension will fallback to a login shell to ensure tests can run correctly. If will try to auto generate a login shell configuration based on the `jest.shell` setting, otherwise, it will use the default `bash` login-shell. Currently supported auto-fallback shells are `bash`, `zsh`, `fish`.
680
+
**Auto recovery with login shell**
681
+
Since v5, if detected shell env issue, such as `node: command not found` or `npm: no such file or directory`, the extension will fallback to a login shell to ensure tests can run correctly. If will try to auto generate a login shell configuration based on the `jest.shell` setting, otherwise, it will use the default `bash` login-shell. Currently supported auto-fallback shells are `bash`, `zsh`, `fish`.
681
682
682
683
683
684
---
@@ -729,6 +730,7 @@ This extension uses babel to parse the test files. For decorators [plugin option
729
730
730
731
---
731
732
733
+
<aid="virtual-folders"></a?
732
734
#### virtualFolders
733
735
734
736
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`.
0 commit comments