Prerequisites
Summary
"Run/Debug Tests" Pester code lense no longer work in latest extension preview. Caused by InvokePesterStub.ps1 being called with parameters with embedded single quotes.
Fails with
& '/root/.vscode-server/extensions/ms-vscode.powershell-preview-2021.10.3/modules/PowerShellEditorServices/InvokePesterStub.ps1' -ScriptPath '''/workspaces/Pester/Samples/demoIssueCodeLensPreview.tests.ps1''' -LineNumber 3 -MinimumVersion5 -Output '''Diagnostic'''
Get-ChildItem: /workspaces/Pester/bin/Pester.psm1:3512:13
Line |
3512 | & $SafeCommands['Get-ChildItem'] -Recurse -Path $p -Filte …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot find path '/workspaces/Pester/Samples/'/workspaces/Pester/Samples/' because it does not exist.
System.Management.Automation.RuntimeException: No test files were found and no scriptblocks were provided. Please ensure that you provided at least one path to a *.Tests.ps1 file, or a directory that contains such file. Or that you provided a ScriptBlock test container.
at Invoke-Pester<End>, /workspaces/Pester/bin/Pester.psm1: line 5220
at <ScriptBlock>, /root/.vscode-server/extensions/ms-vscode.powershell-preview-2021.10.3/modules/PowerShellEditorServices/InvokePesterStub.ps1: line 164
at <ScriptBlock>, <No file>: line 1
PowerShell Version
PS /workspaces/Pester/Samples> $PSVersionTable
Name Value
---- -----
PSVersion 7.0.6
PSEdition Core
GitCommitId 7.0.6
OS Linux 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visual Studio Code Version
PS /workspaces/Pester/Samples> code --version
1.61.2
6cba118ac49a1b88332f312a8f67186f7f3c1643
x64
Extension Version
PS /workspaces/Pester/Samples> code --list-extensions --show-versions | Select-String powershell
Extensions installed on Dev Container: Pester C# (.NET Core) w/ PowerShell:
ms-vscode.powershell-preview@2021.10.3
TylerLeonhardt.vscode-inline-values-powershell@0.0.5
Steps to Reproduce
- Install latest Pester and vscode-powershell-preview-2021.10.3
- Make sure legacy code lens is disabled
"powershell.pester.useLegacyCodeLens": false
- Create sample "demoIssueCodeLensPreview.tests.ps1" with content
Describe "DescribeName" {
Context "ContextName" {
It "ItName" {
1 | Should -Be 1
}
}
}
- Use
Run Tests or Debug Tests code lens on any level in the file above.
Visuals

Logs
No response
Prerequisites
Summary
"Run/Debug Tests" Pester code lense no longer work in latest extension preview. Caused by
InvokePesterStub.ps1being called with parameters with embedded single quotes.Fails with
PowerShell Version
Visual Studio Code Version
Extension Version
Steps to Reproduce
"powershell.pester.useLegacyCodeLens": falseRun TestsorDebug Testscode lens on any level in the file above.Visuals
Logs
No response