From c482cde0c57156bd98fed0a16cde11704d3c834e Mon Sep 17 00:00:00 2001 From: Jakub Jares Date: Thu, 11 Jun 2026 11:30:00 +0200 Subject: [PATCH] Default `useLegacyCodeLens` to `false` for Pester 5 CodeLens Pester 4 has been EOL since 2020 and Pester 5 is the current stable. Default the CodeLens to the Pester 5 layout (`Run Tests` on `It`, `Describe` and `Context`) instead of the Pester 4 one (`Run Tests` on `Describe` only). Users who haven't touched the setting will see CodeLens on `It` and `Context` blocks too, and clicking them runs `InvokePesterStub.ps1` with `-MinimumVersion5`. On systems where only Pester 4 is installed the stub falls back to v4 and warns; tests still run but the line-level filter is a v5 feature. Set `powershell.pester.useLegacyCodeLens` back to `true` to restore the old default. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- package.json | 4 ++-- src/features/PesterTests.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d1e22eaa0c..8da1b1b9a6 100644 --- a/package.json +++ b/package.json @@ -1008,8 +1008,8 @@ "properties": { "powershell.pester.useLegacyCodeLens": { "type": "boolean", - "default": true, - "markdownDescription": "Use a CodeLens that is compatible with Pester 4. Disabling this will show `Run Tests` on all `It`, `Describe` and `Context` blocks, and will correctly work only with Pester 5 and newer." + "default": false, + "markdownDescription": "Use the legacy CodeLens compatible with Pester 4 (only shows `Run Tests` on `Describe` blocks). When disabled (the default), `Run Tests` is shown on all `It`, `Describe` and `Context` blocks for Pester 5 and newer." }, "powershell.pester.codeLens": { "type": "boolean", diff --git a/src/features/PesterTests.ts b/src/features/PesterTests.ts index df6e1abdfa..d344e9f066 100644 --- a/src/features/PesterTests.ts +++ b/src/features/PesterTests.ts @@ -149,7 +149,7 @@ export class PesterTestsFeature implements vscode.Disposable { const useLegacyCodeLens = pesterConfig.get( "useLegacyCodeLens", - true, + false, ); if (!useLegacyCodeLens) { launchConfig.args.push("-MinimumVersion5");