diff --git a/.vscode/settings.json b/.vscode/settings.json index 3e8fc847..7e54e973 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,5 +14,8 @@ "eslint.enable": true, "editor.codeActionsOnSave": { "source.fixAll.eslint": true - } + }, + "cSpell.words": [ + "unmock" + ], } diff --git a/README.md b/README.md index bf5481e0..3643bb22 100644 --- a/README.md +++ b/README.md @@ -254,6 +254,7 @@ Users can use the following settings to tailor the extension for their environme |setting|description|default|example/notes| |---|---|---|---| |**Process**| +|enable|Enable/disable jest extension for the given workspace folder/virtual-folder|true|`"jest.enable": false`| |[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"`| |nodeEnv|Add additional env variables to spawned jest process|null|`"jest.nodeEnv": {"PORT": "9800", "BAR":"true"}` | |[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"]}` | @@ -270,7 +271,6 @@ useDashedArgs| Determine if to use dashed arguments for jest processes |undefine |[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**| -|enable|Enable/disable jest extension for the given workspace folder|true|`"jest.enable": false`| |debugMode|Enable debug mode to diagnose plugin issues. (see developer console)|false|`"jest.debugMode": true`| |disabledWorkspaceFolders 💼|Disabled workspace folders names in multi-root environment|[]|`"jest.disabledWorkspaceFolders": ["package-a", "package-b"]`| |[autoRevealOutput](#autoRevealOutput)|Determine when to show test output|"on-run"|`"jest.autoRevealOutput": "on-exec-error"`| diff --git a/release-notes/release-note-v6.md b/release-notes/release-note-v6.md new file mode 100644 index 00000000..2ddcadb2 --- /dev/null +++ b/release-notes/release-note-v6.md @@ -0,0 +1,108 @@ +# vscode-jest v6.x Releases + +Release Notes +--- +- [Release Notes](#release-notes) +- [v6.0.0 (pre-release)](#v600-pre-release) + - [Main Features](#main-features) + - [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) + - [4. Auto clear output upon test run](#4-auto-clear-output-upon-test-run) + - [Fixes](#fixes) + - [CHANGELOG](#changelog) + +--- + +## 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. + +### Main Features +#### 1. Virtual Folders + +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). + +For example, the unit vs. integration tests can now be set up as the following: +```json +// /.vscode/settings.json +{ + "jest.virtualFolders": [ + { + "name": "unit-tests", + "jestCommandLine": "--config=jest.unit.config.js", + "autoRun": "watch" + }, + { + "name": "integration-tests", + "jestCommandLine": "--config=jest.integration.config.js", + "autoRun": "off" + } + ] + } +``` + +And yes you can indeed use virtual folders with monorepo projects. For example, the following configuration will run tests for each package in a monorepo project: +```json +// /.vscode/settings.json +{ + "jest.virtualFolders": [ + {"name": "package1", "rootPath": "packages/package1"}, + {"name": "package2", "rootPath": "packages/package2"} + ] +} +``` + +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). + + +- [#1035](https://github.com/jest-community/vscode-jest/pull/1035) - @connectdotz + +#### 2. Support spawning jest with dashed arguments + +In light of Angular's decision to drop support for CamelCase arguments, we've been hearing a lot of you asking for a switch to dashed-arguments when running Jest commands. Therefore, a new optional setting `"jest.useDashedArgs"` is introduced. + +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. + +See [Customization](README.md#customization) for more details. + + + +- [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 +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"`. + +See [Customization](README.md#customization) for more details. + +- [#1009](https://github.com/jest-community/vscode-jest/pull/1009) - @connectdotz + +#### 4. Auto clear output upon test run + +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. + +See [Customization](README.md#customization) for more details. + + +- [#1014](https://github.com/jest-community/vscode-jest/pull/1014) - @jgillick + +### Fixes + +- Fixed v2 debug config variable substitution for multi-variable in a given argument. ([#1040](https://github.com/jest-community/vscode-jest/pull/1040) - @adrianisk) +- Fixed a source code parsing error for nonLiteralName. ([#1024](https://github.com/jest-community/vscode-jest/pull/1024) - @connectdotz) +- Various documentation fixes + - [#1016](https://github.com/jest-community/vscode-jest/pull/1016) - @Jazzkid0 + - [#1023](https://github.com/jest-community/vscode-jest/pull/1023) - @connectdotz + - [#1032](https://github.com/jest-community/vscode-jest/pull/1032) - @Ryan-Dia + - [#1038](https://github.com/jest-community/vscode-jest/pull/1038) - @ykray (epic work!) +- Address security vulnerability with dependencies. ([#1011](https://github.com/jest-community/vscode-jest/pull/1011)) + +### CHANGELOG +- [v6.0.0](https://github.com/jest-community/vscode-jest/releases/tag/v6.0.0) + +--- + + diff --git a/release-notes/release-notes.md b/release-notes/release-notes.md index dcb566a0..087b84b9 100644 --- a/release-notes/release-notes.md +++ b/release-notes/release-notes.md @@ -1,3 +1,4 @@ # vscode-jest Release Notes +- [v6](release-note-v6.md) - [v5](release-note-v5.x.md) - [v4](release-note-v4.md) \ No newline at end of file diff --git a/src/extension-manager.ts b/src/extension-manager.ts index 04878b30..ad23bbf3 100644 --- a/src/extension-manager.ts +++ b/src/extension-manager.ts @@ -485,6 +485,7 @@ export class ExtensionManager { const ReleaseNoteBase = 'https://github.com/jest-community/vscode-jest/blob/master/release-notes'; const ReleaseNotes: Record = { + '6.0.0': `${ReleaseNoteBase}/release-note-v6.md#v600-pre-release`, '5.2.3': `${ReleaseNoteBase}/release-note-v5.x.md#v523`, '5.2.2': `${ReleaseNoteBase}/release-note-v5.x.md#v522`, '5.2.1': `${ReleaseNoteBase}/release-note-v5.x.md#v521-pre-release`, diff --git a/tests/extension-manager.test.ts b/tests/extension-manager.test.ts index c395e70f..691e98fd 100644 --- a/tests/extension-manager.test.ts +++ b/tests/extension-manager.test.ts @@ -1223,12 +1223,13 @@ describe('ExtensionManager', () => { expect(ext2.onDidChangeActiveTextEditor).not.toHaveBeenCalled(); }); it.each` - case | version | showChoice | choice | showRN - ${1} | ${'4.6'} | ${false} | ${undefined} | ${false} - ${2} | ${'5.0.0'} | ${true} | ${undefined} | ${false} - ${3} | ${'5.0.0'} | ${true} | ${'See What Is Changed'} | ${true} - ${4} | ${'5.0.1'} | ${true} | ${undefined} | ${false} - ${5} | ${'6.0.0'} | ${false} | ${undefined} | ${false} + case | version | showChoice | choice | showRN + ${1} | ${'4.6'} | ${false} | ${undefined} | ${false} + ${2} | ${'5.0.0'} | ${true} | ${undefined} | ${false} + ${3} | ${'5.0.0'} | ${true} | ${'See What Is Changed'} | ${true} + ${4} | ${'5.0.1'} | ${true} | ${undefined} | ${false} + ${5} | ${'6.0.0'} | ${true} | ${undefined} | ${false} + ${6} | ${'99.0.0'} | ${false} | ${undefined} | ${false} `( 'show release note once for specific version: case $case', async ({ version, showChoice, choice, showRN }) => { diff --git a/tests/test-provider/test-item-data.test.ts b/tests/test-provider/test-item-data.test.ts index 1c53bbd0..68a5829e 100644 --- a/tests/test-provider/test-item-data.test.ts +++ b/tests/test-provider/test-item-data.test.ts @@ -1165,6 +1165,7 @@ describe('test-item-data', () => { expect(listener.dispose).toHaveBeenCalled(); }); it('can adapt raw output to terminal output', () => { + // cSpell: ignore myarn const coloredText = '[2Kyarn run v1.22.5\n'; jestRun.write(coloredText); expect(jestRun.vscodeRun.appendOutput).toHaveBeenCalledWith(