Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Preview-2020.3.2] Enable Legacy Code Lens not working #2603

Closed
mrboring opened this issue Apr 2, 2020 · 4 comments · Fixed by #2606
Closed

[Preview-2020.3.2] Enable Legacy Code Lens not working #2603

mrboring opened this issue Apr 2, 2020 · 4 comments · Fixed by #2606
Labels
Area-Pester Issue-Bug A bug to squash.

Comments

@mrboring
Copy link

mrboring commented Apr 2, 2020

System Details

System Details Output

### VSCode version: 1.43.2 0ba0ca52957102ca3527cf479571617f0de6ed50 x64

### VSCode extensions:
ms-vscode.powershell-preview@2020.3.2

### PSES version: 2.1.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18362
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}       
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

Whilst testing Preview-2020.3.2 with Enable Legacy Code Lens enabled, I noticed that Run test | Debug test appeared against each It command. Also, when running tests, I got the following warning:

WARNING: Pester 5.0.0 or newer is required because setting PowerShell > 
Pester: Enable Legacy Code Lens is disabled, but Pester 4.10.1 is loaded. 
Some of the code lense features might not work as expected.

Here are my steps to reproduce the issue:

  1. Started Windows Sandbox
  2. Installed PowerShell: PowerShell-7.0.0-win-x64.msi
  3. Installed Pester 4.10.1: Install-Module pester -Scope CurrentUser
  4. Installed VS Code: VSCodeUserSetup-x64-1.43.2.msi
  5. Add the following to settings.json:
{
    "editor.fontSize": 11,
    "terminal.integrated.fontSize": 11,
    "extensions.ignoreRecommendations": true,
    "extensions.autoCheckUpdates": false,
    "extensions.autoUpdate": false,
    "powershell.developer.editorServicesLogLevel": "Diagnostic",
    "powershell editor services.trace.server":"verbose",
    "powershell.pester.enableLegacyCodeLens": true
}
  1. Installed PowerShell extension: PowerShell-Preview-2020.3.2.vsix
  2. Closed VS Code
  3. Unzipped test project (Legacy Code Lens not working.zip) to a folder on the desktop
  4. Right clicked on folder and selected Open with Code
  5. Opened Test.Tests.ps1
  6. Checked settings powershell.pester.enableLegacyCodeLens was set to true
  7. Run test | Debug test was available against all It commands
  8. Clicking Run tests above Describe resulted in:
PS C:\Users\WDAGUtilityAccount\Desktop\Legacy Code Lens not working> . 
'c:\Users\WDAGUtilityAccount\.vscode\extensions\ms-vscode.powershell-preview-2020.3.2\InvokePesterStub.ps1' -ScriptPath 'c:\Users\WDAGUtilityAccount\Desktop\Legacy Code Lens 
not working\Test.Tests.ps1' -LineNumber 5 -TestName 'Test-Function' -MinimumVersion5 
-Output 'FromPreference'

WARNING: Pester 5.0.0 or newer is required because setting PowerShell > 
Pester: Enable Legacy Code Lens is disabled, but Pester 4.10.1 is loaded. 
Some of the code lense features might not work as expected.
Pester v4.10.1
Executing all tests in 'c:\Users\WDAGUtilityAccount\Desktop\Legacy Code Lens not working\Test.Tests.ps1' matching test name c:\Users\WDAGUtilityAccount\Desktop\Legacy Code Lens not working\Test.Tests.ps1:5

Executing script c:\Users\WDAGUtilityAccount\Desktop\Legacy Code Lens not working\Test.Tests.ps1

  Describing Test-Function
    [+] dummyTest1 185ms
    [+] dummyTest2 19ms
Tests completed in 1.03s
Tests Passed: 2, Failed: 0, Skipped: 0, Pending: 0, Inconclusive: 0 

Note: The above tests ran, but only after I had manually imported Pester (4.10.1).

image

Expected Behaviour

Not to see Run test | Debug test appeared against each It command.

Not to see a warning about Pester 5.0.0.

Actual Behaviour

I see Run test | Debug test appeared against each It command.

I see a warning about Pester 5.0.0.

Attached Logs

PowerShell Editor Services Log.txt

ms-vscode.powershell-preview-2020.3.2 - Log.zip

@ghost ghost added the Needs: Triage Maintainer attention needed! label Apr 2, 2020
@TylerLeonhardt
Copy link
Member

@nohwnd do you want to take a look at this one?

@nohwnd
Copy link
Contributor

nohwnd commented Apr 2, 2020

Sure :)

@TylerLeonhardt
Copy link
Member

From @mrboring's logs, the correct values are making there way over to PSES:

[Trace - 1:12:41 PM] Sending notification 'workspace/didChangeConfiguration'.
Params: {
    "settings": {
        "powershell": {
            // ...
            "pester": {
                "enableLegacyCodeLens": true,
                "outputVerbosity": "FromPreference"
            }
           // ...

@SydneyhSmith SydneyhSmith added Area-Pester Issue-Bug A bug to squash. and removed Needs: Triage Maintainer attention needed! labels Apr 2, 2020
@nohwnd nohwnd mentioned this issue Apr 3, 2020
4 tasks
@ghost ghost added the Status: In PR label Apr 3, 2020
@nohwnd
Copy link
Contributor

nohwnd commented Apr 3, 2020

Thanks for the detailed repro. The setting was renamed last minute, and one place was missed. The loading module issue is my fault, added falling through to any Pester when the legacy option is disabled but Pester 5 is not found.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Apr 3, 2020
@ghost ghost added Status: Fixed and removed Status: In PR labels Apr 7, 2020
@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Pester Issue-Bug A bug to squash.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants