-
Notifications
You must be signed in to change notification settings - Fork 765
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Allow the execution and debug of sub-tests via VSCode UI #2536
Comments
Created a PR with a working solution for this issue: #2537 |
Test explorer (the beaker icon) provides access to the subtests and that works not only with the subtests with simple string names, but subtests with generated test names. Wonder if there is a way to generate code lenses based on what the test explorer knows about. |
The solution I presented in #2537, while admittedly not bulletproof in anyway, follows exactly the same logic that the extension is already using for the Lines 182 to 195 in 1da1ea2
|
Meanwhile to solve the brittleness issues with regular expressions to find the tests and sub tests I implemented a small CLI tool that parses the AST of a go test source file and returns a JSON outline of all tests and subtests within: https://github.com/devuo/gotestoutline @hyangah let me know if you would be happy with this approach instead of the regular expressions and I'll implement a PR with something based off the |
Thanks @devuo Eventually, the codelens logic belongs to gopls (see the existing test codelens code in gopls. The current version of extension doesn't use this logic yet, but we will eventually let gopls produces test code lenses. (You can test it by setting "gopls.ui.codelenses" "test" codelens). Meanwhile, to get the PR 2537 going
Still I see incorrect subtest arg generation - in case of nested subtests. But that is a bug in "Go: Subtest At Cursor", which can be addressed in a separate issue or as we migrate to |
Change https://go.dev/cl/451755 mentions this issue: |
@hyangah made the requested changes (and a few more as I found some issues while manually testing). I'll wait for your input and OK in the implemented approach before investing time in writing/fixing new/existing tests. |
Is your feature request related to a problem? Please describe.
See below for concrete details of the problem and request.
Describe the solution you'd like
The solution I'd like is for vscode-go to offer the same kind of UX that it currently provides at root test level, but also for sub-tests like JetBrains GoLand, that other languages and test runners in VSCode have.
Here's what it looks like in GoLand:
And here's how the same file looks like in VSCode:
There's no way via the UI to run a sub-test other than with "Go: Subtest At Cursor" command and no way whatsoever to run it in debug mode.
The request therefore is to add support in vscode-go for the same UI buttons that appear in root tests (specifically, "run test" and "debug test") to also appear for sub tests, like in GoLand.
Here's an example of the same exact thing in VSCode but provided by Jest Runner for Jest tests:
The text was updated successfully, but these errors were encountered: