Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prepare for v6.1.0-next release #1093

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 24 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can see the full [features](#features) and learn more details in the [How-To
Happy testing!

## Releases
- **Next** ([v6.0.0](https://github.com/jest-community/vscode-jest/releases/tag/v6.0.0)): [release note](release-notes/release-note-v6.md#v600-pre-release)
- **Next** ([v6.1.0](https://github.com/jest-community/vscode-jest/releases/tag/v6.1.0-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)

Expand Down Expand Up @@ -108,32 +108,22 @@ For detailed releases and migration help, please see [releases](https://github.c

This extension fully integrates with the VSCode testing framework, supporting both automatic and on-demand test runs. In addition to the standard VSCode Test Explorer interface, the extension provides additional UI elements to simplify the development workflow:

<img src="images/testExplorer-6.0.2.png" alt="testExplorer.png" width="1000"/>
<img src="images/interface-6.1.0.png" alt="interface-6.1.0.png" width="1000"/>

1. **Run Mode**: [Run mode](#runmode) dictates the overall user experience, determining when tests should run, how test outputs are displayed or cleared, etc. Different run modes may have different performance implications, particularly for larger projects. The run mode is visible in the Test Explorer (on the folder item) and on the status bar (refer to point 4). Users can change this setting either in `settings.json` (for all runs) or through the UI components mentioned below (for the current session):
- **1.1** Adjust the RunMode using the Test Explorer's run configuration dropdown by selecting "Configure Test Profiles".
- **1.2** Alternatively, alter the RunMode via the Test Explorer's inline menu (associated with the folder item).
<br>

More info:
- [How to change runMode](#runmode-chooser).
- [RunMode performance tradeoff](#runmode-tradeoff)

2. **Test Menu**: Besides automatic test executions (if configured), users can initiate test actions on-demand via:
- **2.1** The Test Explorer inline menu for individual test items. A right/alt click on an item also displays a context menu similar to the editor's gutter menu below.
- **2.2** Right/Alt clicking on the test status indicator in the editor's gutter shows a context menu with relevant test actions, such as run, debug, view, or update snapshots.

More info:
- [How to trigger a test run](#how-to-trigger-the-test-run)
- [How to update and view snapshots](#how-to-update-and-view-snapshots).
1. **Dynamic Run Mode**: [Run mode](#runmode) dictates the overall user experience, determining when tests should run, with or without coverage, error display style, etc. Different run modes may have different [performance implications](#runmode-tradeoff), particularly for larger projects.

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".
<br>

3. **Test Output**: Alongside the test status visible in the editor and TestExplorer tree view, the extension offers native jest run outputs, extension configuration details, and [quick-fix](#quick-fix-chooser) suggestions through vscode terminals (labeled as "Jest (folder-name)"). By default, the output automatically appears when tests run, but this can be adjusted via the [runMode](#runmode) setting.
- **3.1** The output terminal can be accessed on-demand using the TestExplorer inline menu (on the folder item) or the status bar item (refer to point 4).
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).
<br>

4. **Extension Status**: Upon successful launch of the extension, it displays the active folder run status and the aggregated workspace test stats in the status bar. Clicking on the item reveals the associated output window.
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.
<br>

More info:
- [How to read the StatusBar](#how-to-read-the-statusbar)

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.

## How To?
### How to set up the extension?
Expand Down Expand Up @@ -283,12 +273,12 @@ useDashedArgs| Determine if to use dashed arguments for jest processes |undefine
|**UX**|
|[outputConfig](#outputconfig) 💼|Controls test output experience across the whole workspace.|undefined|`"jest.outputConfig": "neutral"` or `"jest.outputConfig": {"revealOn": "run", "revealWithFocus": "terminal", "clearOnRun": 'terminal"`| >= v6.1.0
|[runMode](#runmode)|Controls most test UX, including when tests should be run, output management, etc|undefined|`"jest.runMode": "watch"` or `"jest.runMode": "on-demand"` or `"jest.runMode": {"type": "on-demand", "deferred": true}`| >= v6.1.0
|:x: autoClearTerminal|Clear the terminal output at the start of any new test run.|false|`"jest.autoClearTerminal": true`| >= v6.0.0 < 6.1 (replaced by outputConfig)
|:x: autoClearTerminal|Clear the terminal output at the start of any new test run.|false|`"jest.autoClearTerminal": true`| v6.0.0 (replaced by outputConfig)
|:x: [testExplorer](#testexplorer) |Configure jest test explorer|null|`{"showInlineError": "true"}`| < 6.1.0 (replaced by runMode)
|:x: [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"}`| <= v6.1.0 (replaced by runMode)
|:x: [autoRevealOutput](#autoRevealOutput)|Determine when to show test output|"on-run"|`"jest.autoRevealOutput": "on-exec-error"`| <= v6.1.0 (replaced by outputConfig)
|:x: [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"}`| < v6.1.0 (replaced by runMode)
|:x: [autoRevealOutput](#autoRevealOutput)|Determine when to show test output|"on-run"|`"jest.autoRevealOutput": "on-exec-error"`| < v6.1.0 (replaced by outputConfig)
|**Coverage**|
|:x: showCoverageOnLoad|Show code coverage when extension starts|false|`"jest.showCoverageOnLoad": true`| <= v6.1.0 (replaced by runMode)
|:x: showCoverageOnLoad|Show code coverage when extension starts|false|`"jest.showCoverageOnLoad": true`| < v6.1.0 (replaced by runMode)
|[coverageFormatter](#coverageFormatter)|Determine the coverage overlay style|"DefaultFormatter"|`"jest.coverageFormatter": "GutterFormatter"`|
|[coverageColors](#coverageColors)|Coverage indicator color override|undefined|`"jest.coverageColors": { "uncovered": "rgba(255,99,71, 0.2)", "partially-covered": "rgba(255,215,0, 0.2)"}`|
|**Misc**|
Expand Down Expand Up @@ -484,6 +474,7 @@ interface JestRunModeOptions {
runAllTestsOnStartup?: boolean;
coverage?: boolean;
deferred?: boolean;
showInlineError?: boolean;
}
export type JestRunMode = JestRunModeOptions & (
| { type: 'watch' }
Expand Down Expand Up @@ -567,7 +558,7 @@ While the concepts of performance and automation are generally clear, "completen

**Migration Guide**
<a id="runmode-migration"></a>
Starting from v6.1.0, if no runMode is defined in settings.json, the extension will automatically generate one using legacy settings (`autoRun`, `autoRevealOutput`, `showCoverageOnLoad`). To migrate, simply use the `"Jest: Save Current RunMode"` command from the command palette to update the setting, then remove the deprecated settings.
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.

---

Expand Down Expand Up @@ -659,6 +650,11 @@ There are 2 ways to change autoRun:
---

#### testExplorer

<div style="background-color: yellow; color: black; padding: 10px; border-radius: 5px;">
As of v6.1.0, this setting has been folded into <a href="#runmode">runMode</a>. For transition details, please refer to the <a href="#runmode-migration">runMode migration</a>.
</div>

```ts
testExplorer = {showInlineError?: boolean}
```
Expand Down Expand Up @@ -701,7 +697,7 @@ Default is `"jest.monitorLongRun":60000` (1 minute)

#### autoRevealOutput
<div style="background-color: yellow; color: black; padding: 10px; border-radius: 5px;">
As of v6.1.0, <a href="#runmode">runMode</a> has superseded autoRevealOutput. For transition details, please refer to the <a href="#runmode-migration">runMode migration</a>.
As of v6.1.0, this setting has been folded into <a href="#runmode">runMode</a>. For transition details, please refer to the <a href="#runmode-migration">runMode migration</a>.
</div>

```ts
Expand Down
Binary file added images/interface-6.1.0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
143 changes: 142 additions & 1 deletion release-notes/release-note-v6.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,22 @@

Release Notes
---

- [Release Notes](#release-notes)
- [v6.0.0 (pre-release)](#v600-pre-release)
- [v6.1.0 (pre-release)](#v610-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)
- [1.2 Configuration and Examples](#12-configuration-and-examples)
- [1.3 Deprecations and Migrations](#13-deprecations-and-migrations)
- [2. Support VSCode "TEST RESULTS" Panel with "jest.outputConfig"](#2-support-vscode-test-results-panel-with-jestoutputconfig)
- [2.1 "TEST RESULTS" Panel Integration](#21-test-results-panel-integration)
- [2.2 Configuration and Examples](#22-configuration-and-examples)
- [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)
- [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)
Expand All @@ -14,6 +27,134 @@ Release Notes

---

## v6.1.0 (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.

While we aim for backward compatibility, the nature of the advancements may not align seamlessly with all existing configurations. Users are advised to refer to the Migration Guide provided for each feature to ensure a smooth transition.

As with any pre-release, your feedback is invaluable to us. If you encounter any unexpected behavior or have suggestions for improvement, do not hesitate to report it [here](https://github.com/jest-community/vscode-jest/issues).


### Main Features
#### 1. Enhanced Test Execution Control with "runMode"

https://github.com/jest-community/vscode-jest/assets/891093/9bd4e414-b7aa-43f1-bc89-ffaf30959fe0

Replacing `jest.autoRun` and related settings, the new `runMode` configuration simplifies the test execution process, resolves confusion for newcomers, and introduces more efficient workflows with modes like "deferred."

##### 1.1 The "deferred" mode
The "deferred" mode addresses startup performance, particularly for large projects, by postponing preparation tasks until the first test run or until the user disables deferred mode.

##### 1.2 Configuration and Examples
`"jest.runMode"` offers flexible configurations, allowing for both predefined modes and detailed customization. Here are some configuration examples:
```json
// for "on-demand" runMode
{
"jest.runMode": "on-demand"
}

// for "on-demand" and deferred: the most light-weight startup
{
"jest.runMode": {
"type": "on-demand",
"deferred": true
}
}

// watch mode with coverage and startup full run: the most complete setup
{
"jest.runMode": {
"type": "watch",
"runAllTestsOnStartup": true,
"coverage": true
}
}

// on-save mode for test file only and show inline error
{
"jest.runMode": {
"type": "on-save",
"testFileOnly": true,
"showInlineError": true
}
}
```
Detailed explanations and more examples are available in the [RunMode](https://github.com/jest-community/vscode-jest#runmode).

##### 1.3 Deprecations and Migrations
The following settings have been consolidated into `runMode` and will be removed in the future release:

- "jest.autoRun"
- "jest.showCoverageOnLoad"
- "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).

#### 2. Support VSCode "TEST RESULTS" Panel with "jest.outputConfig"

https://github.com/jest-community/vscode-jest/assets/891093/6b2fa5b6-8790-493a-803a-4cddbce05ccd

The extension now supports the display of test results in VSCode's "TEST RESULTS" panel, complementing the traditional output in the integrated TERMINAL, through a new `"jest.outputConfig"` setting. This allows for a simple and consistent control over both panels.

##### 2.1 "TEST RESULTS" Panel Integration

The VSCode "TEST RESULTS" panel is controlled by a native `"testing.openTesting"` setting, which might not align with the extension's settings. To avoid conflicts, you may set `"testing.openTesting"` to `"neverOpen"` if you prefer this extension to handle the panel behavior through the new `"jest.outputConfig"` setting. More detailed explanation can be found in the [Handling Conflict](https://github.com/jest-community/vscode-jest#outputconfig-conflict) section.

##### 2.2 Configuration and Examples

We've introduced the `"jest.outputConfig"` setting to give users comprehensive control over the test output behavior across TERMINAL and TEST RESULTS panels, moving to a workspace-level setting for broader applicability.

Here are a few scenarios and how to configure them:

```json
// Minimal interaction, suitable for watch/on-save modes
{
"testing.openTesting": "neverOpen",
"jest.outputConfig": "neutral"
}

// Auto-focus on "TEST RESULTS" when errors occur, ideal for on-demand testing
{
"testing.openTesting": "neverOpen",
"jest.outputConfig": {
"revealOn": "error",
"revealWithFocus": "test-results"
}
}

// Terminal-focused output with clean start for each run, preferred for on-demand mode
{
"testing.openTesting": "neverOpen",
"jest.outputConfig": {
"revealWithFocus": "terminal",
"clearOnRun": "terminal"
}
}
```
For more detailed examples and explanations, refer to the [OutputConfig](https://github.com/jest-community/vscode-jest#outputconfig).

##### 2.3 Deprecations and Migration

The following settings have been consolidated into `outputConfig` and will be removed in the future release:
- `"jest.autoRevealOutput"`
- `"jest.autoClearTerminal"`

To migrate, use the `"Jest: Save Current Output Config"` command, and then manually adjust your "settings.json" as needed. If any conflicts arise, the extension will guide you through resolving them.

For a step-by-step migration process, see the [OutputConfig Migration Guide](https://github.com/jest-community/vscode-jest#outputconfig-migration).


### Bug Fixes
- 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)

### 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)

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.
Expand Down
Loading