Skip to content

Debugger crashing unexpectedly on Pester tests #66

Closed
@AndrewGaspar

Description

@AndrewGaspar

I've got a pester test that I'm trying to debug in VS Code. To invoke the test, I have a script pester.ps1 registered to a debug configuration in .vscode\launch.json. This script is simple:

.vscode\pester.ps1:

Invoke-Pester -Path (Join-Path $PSScriptRoot "..")

My pester code looks like this:
tests\MyModule.Tests.ps1

using module ..\MyModule

Describe "Tests for MyModule" {
  Context "MyModule foo config tests" {
    It "should do bar" {
      # ..
    }

    It "should handle baz" {
      # ..
    }
  }
}

Watching the Debug Console, the Describe and Context portion are logged before the debugger crashes. If I put a breakpoint on the Context line, however, it crashes before breaking, only printing the Describe line. If I put a breakpoint on the Describe line, it successfully breaks into the debugger at that line.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions