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

Test debugging #1927

Merged
merged 4 commits into from
Sep 16, 2023
Merged

Test debugging #1927

merged 4 commits into from
Sep 16, 2023

Conversation

farlee2121
Copy link
Contributor

WHAT

Add ability to debug unit tests from the Ionide Test Explorer.

2023-09-12-debug.mp4

Debug is also available from the gutter decoration
image

HOW

Add a new test run profile for debugging.
When the debugging profile is selected,

  1. set the right environment variable for vstest to return the processId (and wait for a debugger to attach)
  2. parse the processId out of the output
  3. attach to that process with a vscode attach profile
  4. workbench.action.debug.continue to get past the stop on entry that can be confusing

I tested to make sure it works across frameworks (Expecto, XUnit, etc) and when multiple projects are run.

Remove duplicated code and improve separation of concerns
Vscode.debug.startDebugging (Some folder, U2.Case2 launchRequest)
|> Promise.ofThenable

do! Promise.sleep 2000
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have to wait or it'll continue before the debugger reaches the stop on entry point.
That'll leave the debugger in a confusing state where it shows it's attached but no breakpoints are hit and the breakpoints show as disabled

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely leave a code comment for this one then.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
Also commented on the processId weirdness

Copy link
Member

@TheAngryByrd TheAngryByrd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works great! Thank you 🎸

As a note for Expecto users, if you want to actually run only one test you'll need to update YoloDev to 0.14.2

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

Successfully merging this pull request may close these issues.

2 participants