vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

Go Test Explorer shows wrong state 'running' after it errors refusing to run multiple tests with debugger

Open jimsnab opened this issue 3 years ago • 3 comments

What version of Go, VS Code & VS Code Go extension are you using?

Version Information
  • Run go version to get version of Go from the VS Code integrated terminal.
    • go version go1.17.1 linux/amd64
  • Run gopls -v version to get version of Gopls from the VS Code integrated terminal.
    • golang.org/x/tools/gopls v0.7.5
  • Run code -v or code-insiders -v to get version of VS Code or VS Code Insiders.
    • 1.63.2 899d46d82c4c95423fb7e10e68eba52050e30ba3 x64
  • Check your installed extensions to get the version of the VS Code Go extension
    • go v0.30.0
  • Run Ctrl+Shift+P (Cmd+Shift+P on Mac OS) > Go: Locate Configured Go Tools command.
    • too long and seemingly irrelevant

Share the Go related settings you have added/edited

Run Preferences: Open Settings (JSON) command to open your settings.json file. Share all the settings with the go. or ["go"] or gopls prefixes.

Describe the bug

The Go test runner doesn't support debug of multiple tests, according to a red message that appears when trying it. However, after the red message appears and go extension fails, the vscode test runner shows the test as running, and the stop button doesn't operate. vscode has to be relaunched to recover.

This use case suggests a deeper issue with extension error handling.

Steps to reproduce the behavior:

  1. Load a project with 2 or more unit tests that the vscode "Testing" panel can run, and can debug a single test
  2. At the top level container in Testing panel, click the Debug Test icon to attempt to run all the tests with a debugger attached

Screenshots or recordings

vscode-go-test-runner

jimsnab avatar Jan 23 '22 22:01 jimsnab

Thanks for the report @jimsnab

Currently the code is written in a way to require users to act on the error message prompt (await vscode.window.showErrorMessage(...)). So, you will need to close the popup to bring the text explorer back to the initial state.

I see two issues involved here

  • Should we wait for vscode.window.showErrorMessage to be resolved? Maybe not.
  • Allow to debug multiple tests. At least, when debug/profile are requested in a single package level, we may consider package-level debugging.

cc @firelizzard18

hyangah avatar Jan 25 '22 17:01 hyangah

Debugging multiple tests is definitely something I planned on. I was intending to do that after updating the old test support to use the new test explorer machinery. Unfortunately my day job leaves me very little time for side projects.

firelizzard18 avatar Jan 25 '22 19:01 firelizzard18

This is resolved in #3523. Debugging multiple tests within the same package works, and attempting to debug multiple tests within different packages will A) properly end the run and B) show an error in the UI: image image

firelizzard18 avatar Sep 05 '24 01:09 firelizzard18