PowerShell / PowerShell/PowerShellEditorServices

Trying to "wait for debugger" in tests doesn't work

Open
#676 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Test Issue-Bug
Dominant language
C#
Stars
767
Forks
266
Avg merge
3d 16h
Merged PRs (30d)
1

Description

There are lines in both LanguageServerTests.cs and DebugServerTests.cs that can be uncommented to enable debugger attachment:

https://github.com/PowerShell/PowerShellEditorServices/blob/4bb71bd93320ba9b2105e3b5d2007f09f0f4a959/test/PowerShellEditorServices.Test.Host/LanguageServerTests.cs#L53

However, trying these in VSCode, I just get a bunch of error dialogs pop up in the machine's native UI and the tests just plough on and fail. I'm guessing this option is meant for Visual Studio usage, rather than VSCode.

I'm thinking we should retire this functionality and instead add a compile-time-conditional block with something like a Console.ReadKey() that reports the process ID of the test runner (that's how I tend to do it at the moment at least).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Inspect the debugger-attachment lines in LanguageServerTests.cs and DebugServerTests.cs, starting with the linked LanguageServerTests.cs location. Reproduce the behavior in VSCode and compare the native error dialogs and continued test execution with the intended debugging workflow. Done means the obsolete behavior is retired or replaced with the proposed test-runner pause and process identification, with the tests providing a usable attachment point.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell, vscode
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.