question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pester code lens broken in latest preview

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
JustinGrotecommented, Oct 29, 2021

I’m seeing the same, was trying to dig into where that might ahve changed.

2reactions
JustinGrotecommented, Oct 29, 2021

@fflaten I saw the same issue in my Pester Tests extension, something about the double quoting of the first arg got “fixed” whereas before it was being removed. https://github.com/pester/vscode-adapter/issues/88

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode | Pester
With Pester 5 it is finally possible to run and debug just a single test in VSCode! Shows a single test being run...
Read more >
CodeLens not showing up for my solution
A fix for this issue is now available in preview release. Try out the fix by installing the most recent preview from https://visualstudio.microsoft.com/vs/ ......
Read more >
rme - River Thames Conditions - Environment Agency - GOV.UK
Srbi u becu forum, Nana komatsu listal, Apple vacations promo code, Kahului restaurants on the water? Coal mine explosion nova scotia, Concrete sawing ......
Read more >
Who uses Visual Studio Code for PowerShell Scripting? - Reddit
Try the new preview. It's a large architectural redesign that solves a lot of "stop working" problems. It's got some bugs due to...
Read more >
Untitled
Fox 180 vicious pants, New zealand auckland area code, En profondeur radio ... news reader, Sv6 engine capacity, Quebec nursing home fire 2014,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found