Skip to content

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

Closed
@mrboring

Description

@mrboring

System Details

System Details Output

### VSCode version: 1.43.2 0ba0ca52957102ca3527cf479571617f0de6ed50 x64

### VSCode extensions:
[email protected]

### 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions