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

Pester stopped working in vscode #2408

Closed
3 tasks done
vojtech-kasny opened this issue Nov 29, 2023 · 2 comments
Closed
3 tasks done

Pester stopped working in vscode #2408

vojtech-kasny opened this issue Nov 29, 2023 · 2 comments

Comments

@vojtech-kasny
Copy link

Checklist

What is the issue?

Error is thrown from vscode:

InvalidOperation: You cannot call a method on a null-valued expression.
InvalidOperation: You cannot call a method on a null-valued expression.
InvalidOperation: You cannot call a method on a null-valued expression.
System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.Interpreter.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.LightLambda.RunVoid1[T0](T0 arg0)
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.CommandProcessorBase.Complete()
at New-PesterState, C:\Program Files\WindowsPowerShell\Modules\Pester\5.5.0\Pester.psm1: line 616
at Invoke-Test, C:\Program Files\WindowsPowerShell\Modules\Pester\5.5.0\Pester.psm1: line 2447
at Invoke-Pester<End>, C:\Program Files\WindowsPowerShell\Modules\Pester\5.5.0\Pester.psm1: line 5046
at <ScriptBlock>, C:\Users\<username>\.vscode\extensions\ms-vscode.powershell-2023.8.0\modules\PowerShellEditorServices\InvokePesterStub.ps1: line 176
at <ScriptBlock>, <No file>: line 1

Note:

Testing works using PowerShell (outside of vscode) using e.g. Invoke-Pester C:\temp\demo.tests.ps1 -Output Detailed

Expected Behavior

Tests are performed

Steps To Reproduce

  • open Visual Studio Code (latest stable build)
    Version: 1.84.2 (user setup)
    Commit: 1a5daa3a0231a0fbba4f14db7ec463cf99d7768e
    Date: 2023-11-09T10:51:52.184Z
    Electron: 25.9.2
    ElectronBuildId: 24603566
    Chromium: 114.0.5735.289
    Node.js: 18.15.0
    V8: 11.4.183.29-electron.0
    OS: Windows_NT x64 10.0.22621
    
  • install latest Pester module version (5.5.0)
  • create any test file
  • define any test
  • click Run tests from the editor

Describe your environment

Pester version     : 5.5.0 C:\Program Files\WindowsPowerShell\Modules\Pester\5.5.0\Pester.psm1
PowerShell version : 7.4.0
OS version         : Microsoft Windows NT 10.0.22621.0

Possible Solution?

No response

@fflaten
Copy link
Collaborator

fflaten commented Dec 2, 2023

Thanks for the report. I'm unable to reproduce the issue. The stacktrace points to an unexpected flow where Pester's run state is missing.

  • Is it consistently throwing the same error?
  • Does it also work if you change VSCode to use Windows PowerShell?
  • Which language mode is your PowerShell session running in? You can check using $ExecutionContext.SessionState.LanguageMode
  • Could you provide a test file?

@fflaten
Copy link
Collaborator

fflaten commented May 4, 2024

Closing due to inactivity and can't repro. Will reopen if someone's able provide repro steps.

@fflaten fflaten closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants