diff --git a/.vscode/settings.json b/.vscode/settings.json index c19dd43a6..3cecdd388 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,8 +18,13 @@ "cSpell.words": [ "unmock" ], - "testing.openTesting": "neverOpen", - "jest.outputConfig": { - "clearOnRun": "terminal" - } + "markdown.validate.ignoredLinks": [ + "#runmode-chooser", + "#runmode-tradeoff", + "#quick-fix-chooser", + "#virtual-folders", + "#outputconfig-conflict", + "#runmode-migration", + "#auto-recovery-login-shell" + ] } diff --git a/README.md b/README.md index 9734a64d3..6628648ad 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ This extension supports full [jest](https://jestjs.io/) features in vscode envir 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: -![image](images/v5-output-terminals.png) +![image](images/v6-quick-start.png) 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: @@ -26,9 +26,9 @@ You can see the full [features](#features) and learn more details in the [How-To Happy testing! ## Releases -- **Next** ([v6.1.2](https://github.com/jest-community/vscode-jest/releases/tag/v6.1.2-next)): [release note](release-notes/release-note-v6.md#v610-pre-release) -- **Current** ([v5.2.3](https://github.com/jest-community/vscode-jest/releases/tag/v5.2.3)): [release note](release-notes/release-note-v5.x.md#v523) -- **Previous** ([v5.1.0](https://github.com/jest-community/vscode-jest/releases/tag/v5.1.0)): [release note](release-notes/release-note-v5.x.md#v510) +- **Current** ([v6.2.0](https://github.com/jest-community/vscode-jest/releases/tag/v6.2.0)): [release note](release-notes/release-note-v6.md#v620) +- **Previous** ([v5.2.3](https://github.com/jest-community/vscode-jest/releases/tag/v5.2.3)): [release note](release-notes/release-note-v5.x.md#v523) + All: [Release Notes](release-notes/release-notes.md) @@ -86,15 +86,15 @@ Content ## Features * Starts Jest automatically for most projects with runnable jest configurations. +* Supports monorepo, react, react-native, angular, vue and various configurations/platforms. +* Supports running multiple jest processes within the same workspace folder. * Fully integrated with the vscode TestExplorer. +* Help debug jest tests in vscode. +* View and update snapshots interactively. +* Show coverage information in files being tested. * Supports both automatic and manual test runs at any level, and easy-switch via UI. * Supports additional IntelliSense for jest methods. * Show fails inline of the `expect` function, as well as in the problem inspector. -* View and update snapshots interactively. -* Help debug jest tests in vscode. -* Show coverage information in files being tested. -* Supports monorepo, react, react-native, angular, vue and various configurations/platforms. -* Supports running multiple jest processes from the same workspace folder. * active community support. ## Installation @@ -117,13 +117,13 @@ This extension fully integrates with the VSCode testing framework, supporting bo 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".
-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). +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).
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.
-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. +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. ## How To? ### 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 ### How to use code coverage? Code coverage can be triggered via -1. change [runMode](#runmode) config via [chooser](#run-modoe-chooser) or settings. +1. change [runMode](#runmode) config via [chooser](#runmode-chooser) or settings. 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). The coverage stats will be displayed at the source code editor: summary at the top and inline coverage indicator based on the formatter selected. coverage-screen-shot -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)) +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)) 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. @@ -348,7 +348,7 @@ for example: #### outputConfig -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. +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. **Type Definitions** ```ts @@ -556,8 +556,8 @@ While the concepts of performance and automation are generally clear, "completen 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. -**Migration Guide** +**Migration Guide** 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. --- @@ -579,7 +579,7 @@ Performance and automation are self-explanatory, "completeness" might not: 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.). There are 2 ways to change autoRun: -1. Temporarily [toggle autoRun on/off in TestExplorer](#how-to-toggle-auto-run) +1. Temporarily toggle autoRun on/off in TestExplorer 2. Change "jest.autoRun" in `settings.json` file. **autoRun Configuration** @@ -609,7 +609,7 @@ There are 2 ways to change autoRun:
example - - Turn off auto run, users need to trigger tests run manually via [run commands](#commands-run) and [menus](#context-menu): + - Turn off auto run, users need to trigger tests run manually via run commands or context menu: ```json "jest.autoRun": "off" ``` @@ -677,7 +677,8 @@ By default, jest command is executed in default shell ('cmd' for windows, '/bin/ Note the LoginShell is only applicable for non-windows platform and could cause a bit more overhead. -_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`. +**Auto recovery with login shell** +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`. --- @@ -729,6 +730,7 @@ This extension uses babel to parse the test files. For decorators [plugin option --- + -Release Notes +Release Notes --- -- [Release Notes](#release-notes) -- [v6.1.0 (pre-release)](#v610-pre-release) +- [v6.2.0](#v620) + - [New Features Summary](#new-features-summary) + - [Bug Fixes and Technical Debt Reduction](#bug-fixes-and-technical-debt-reduction) + - [Breaking Changes](#breaking-changes) + - [CHANGELOG](#changelog) +- [v6.1 (pre-release)](#v61-pre-release) - [Main Features](#main-features) - [1. Enhanced Test Execution Control with "runMode"](#1-enhanced-test-execution-control-with-runmode) - [1.1 The "deferred" mode](#11-the-deferred-mode) @@ -16,18 +20,51 @@ Release Notes - [2.3 Deprecations and Migration](#23-deprecations-and-migration) - [Bug Fixes](#bug-fixes) - [Technical Debt](#technical-debt) -- [v6.0.0 (pre-release)](#v600-pre-release) +- [v6.0 (pre-release)](#v60-pre-release) - [Main Features](#main-features-1) - [1. Virtual Folders](#1-virtual-folders) - [2. Support spawning jest with dashed arguments](#2-support-spawning-jest-with-dashed-arguments) - - [3. control extension activation within each folder](#3-control-extension-activation-within-each-folder) + - [3. Control extension activation within each folder](#3-control-extension-activation-within-each-folder) - [4. Auto clear output upon test run](#4-auto-clear-output-upon-test-run) - [Fixes](#fixes) - - [CHANGELOG](#changelog) + - [CHANGELOG](#changelog-1) + +--- + +## v6.2.0 +This version is a rollup of pre-releases [v6.0](#v60-pre-release) through [v6.1](#v61-pre-release), which implemented a few long requested features, such as better monorepo project support, more intuitive ways to defer and resume testing, and showing accurate test results in TEST RESULT panel. + +![v6.2.0-intro](../images/v6.2.0-intro.png) + +### New Features Summary +- **Virtual Folders**: New in v6.0.0, [jest.virtualFolders](https://github.com/jest-community/vscode-jest#virtualfolders) now supports monorepos for single-root workspaces and multiple Jest configurations in the same folder — long-awaited capabilities for developers dealing with complex project setups. [Details](#1-virtual-folders) +- **Integration with VSCode "TEST RESULTS" Panel**: Introduced in v6.1.0, the [jest.outputConfig](https://github.com/jest-community/vscode-jest#outputconfig) setting enables the display of test results directly in the VSCode "TEST RESULTS" panel and consolidates various output settings. [Details](#2-support-vscode-test-results-panel-with-jestoutputconfig) (:warning: **Breaking Change**) +- **Replace "autoRun" with "runMode"**: Debuting in v6.1.0, [jest.runMode](https://github.com/jest-community/vscode-jest#runmode) replaces and expands upon [jest.autoRun](https://github.com/jest-community/vscode-jest#autorun) with options like `'deferred'` mode, ideal for large projects seeking just-in-time test execution. It also consolidates related settings for a cleaner configuration experience. [Details](#1-enhanced-test-execution-control-with-runmode) (:warning: **Breaking Change**) +- **Support for Spawning Jest with Dashed Arguments**: Available from v6.0.0, the new [jest.useDashedArgs](https://github.com/jest-community/vscode-jest?tab=readme-ov-file#settings) setting allows the extension to spawn Jest processes with dashed arguments, required by some frameworks such as Angular. [Details](#2-support-spawning-jest-with-dashed-arguments) +- **Control Extension Activation within Each Folder:** Introduced in v6.0.0, the [jest.enable](https://github.com/jest-community/vscode-jest?tab=readme-ov-file#settings) setting allows granular control over the Jest extension's activation on a per-folder basis in VS Code workspaces. This enhancement is beneficial for developers working in multi-root workspaces or projects with mixed languages. [Details](#3-control-extension-activation-within-each-folder) + +### Bug Fixes and Technical Debt Reduction +- Please refer to the pre-release notes for a comprehensive list. + +### Breaking Changes +- The following settings have been consolidated into `runMode` and `outputConfig` and will be removed in the future release: + - `"jest.autoRun"` + - `"jest.showCoverageOnLoad"` + - `"jest.TestExplorer"` + - `"jest.autoRevealOutput"` + - `"jest.autoClearTerminal"` + +- While we strive for seamless auto migration and backward compatibility, it might not cover all configurations. Should you discover any discrepancies or unexpected behavior, further guidance and support can be found in the detailed release notes linked above and the migrationn guides below: + - [RunMode Migration Guide](https://github.com/jest-community/vscode-jest#runmode-migration) + - [OutputConfig Migration Guide](https://github.com/jest-community/vscode-jest#outputconfig-migration) + +### CHANGELOG +- [v6.2.0](https://github.com/jest-community/vscode-jest/releases/tag/v6.2.0) --- -## v6.1.0 (pre-release) + +## v6.1 (pre-release) This release introduces a more streamlined ["jest.runMode"](https://github.com/jest-community/vscode-jest#runmode) setting to boost test execution efficiency, coupled with the integration of the "TEST RESULTS" panel via the new ["jest.outputConfig"](https://github.com/jest-community/vscode-jest#outputconfig) for a consistent test results display. These enhancements should simplify the transition for newcomers and also improve startup times for larger projects, while offering more control over test output visibility. @@ -87,7 +124,7 @@ The following settings have been consolidated into `runMode` and will be removed - "jest.autoRun" - "jest.showCoverageOnLoad" -- "TestExplorer" +- "jest.TestExplorer" For a smooth transition, users should migrate to the new `runMode`` setting. Assistance with migration is provided by the `"Jest: Save Current RunMode"`` command in the command palette. Complete migration steps can be found in the [RunMode Migration Guide](https://github.com/jest-community/vscode-jest#runmode-migration). @@ -149,13 +186,17 @@ For a step-by-step migration process, see the [OutputConfig Migration Guide](htt - Fixed an issue where the virtual folder `rootPath` was not resolved correctly for folder test items, causing test runs or debugging to fail. ([#1080](https://github.com/jest-community/vscode-jest/pull/1080) - @akwodkiewicz) - Resolved a matching problem during manual test runs where a non-exact match led to more tests being run than specified. ([#1091](https://github.com/jest-community/vscode-jest/pull/1091) - @connectdotz) - Corrected the status recording for running `".each"` test/describe blocks which sometimes did not reflect accurately. ([#1092](https://github.com/jest-community/vscode-jest/pull/1092) - @connectdotz) +- fix anchors in contributing.md file by @krivonos28 in [#1102](https://github.com/jest-community/vscode-jest/pull/1102) +- more fault-tolerant for shell setting by @connectdotz in [#1100](https://github.com/jest-community/vscode-jest/pull/1100) +- fix active editor files sometimes got attached to the wrong workspace folder by @connectdotz in [#1108](https://github.com/jest-community/vscode-jest/pull/1108) ### Technical Debt - Updated the CI node version check to now include versions 18 through 20, ensuring compatibility with the latest node releases. ([#1088](https://github.com/jest-community/vscode-jest/pull/1088) - @connectdotz) - Upgraded tooling dependencies to their latest versions to improve development workflows and bring in new features and bug fixes from those tools. ([#1089](https://github.com/jest-community/vscode-jest/pull/1089) - @connectdotz) -## v6.0.0 (pre-release) + +## v6.0 (pre-release) This major release introduces the 'Virtual Folders' feature. Much like a VSCode workspace folder, a 'Virtual Folder' allows you to manage a custom Jest runtime environment, each configurable with its own resource-level settings. This is particularly useful for projects with multiple Jest configurations or monorepo structures. While we've ensured backward compatibility, the introduction of 'Virtual Folders' involved significant internal changes that prompted a major version bump. @@ -212,7 +253,7 @@ See [useDashedArgs](https://github.com/jest-community/vscode-jest#usedashedargs) - [jest-community/jest-editor-support#103](https://github.com/jest-community/jest-editor-support/pull/103) - @mjamin - [#1034](https://github.com/jest-community/vscode-jest/pull/1034) - @connectdotz -#### 3. control extension activation within each folder +#### 3. Control extension activation within each folder A new setting`"jest.enable"` is added as a quick way to turn off the extension feature for the given folder/virtual-folder without uninstall/disable completely in vscode. 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"`. diff --git a/src/extension-manager.ts b/src/extension-manager.ts index 68b0314f3..8fe97268f 100644 --- a/src/extension-manager.ts +++ b/src/extension-manager.ts @@ -529,6 +529,7 @@ export class ExtensionManager { const ReleaseNoteBase = 'https://github.com/jest-community/vscode-jest/blob/master/release-notes'; const ReleaseNotes: Record = { + '6.2.0': `${ReleaseNoteBase}/release-note-v6.md#v620`, '6.1.0': `${ReleaseNoteBase}/release-note-v6.md#v610-pre-release`, '6.0.0': `${ReleaseNoteBase}/release-note-v6.md#v600-pre-release`, '5.2.3': `${ReleaseNoteBase}/release-note-v5.x.md#v523`,