Skip to content

Pester code lens broken in latest preview #3652

Closed
@fflaten

Description

@fflaten

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.

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

  1. Install latest Pester and vscode-powershell-preview-2021.10.3
  2. Make sure legacy code lens is disabled "powershell.pester.useLegacyCodeLens": false
  3. Create sample "demoIssueCodeLensPreview.tests.ps1" with content
Describe "DescribeName" {
    Context "ContextName" {
        It "ItName" {
            1 | Should -Be 1
        }
    }
}
  1. Use Run Tests or Debug Tests code lens on any level in the file above.

Visuals

image

Logs

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions