Skip to content

Update test explorer when tests run from "go.testOnSave" #2483

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

Open
pierrre opened this issue Sep 28, 2022 · 7 comments
Open

Update test explorer when tests run from "go.testOnSave" #2483

pierrre opened this issue Sep 28, 2022 · 7 comments
Labels
FeatureRequest Go Companion Issues relating to the Go Companion extension go-test issues related to go test support (test output, test explorer, ...) WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@pierrre
Copy link

pierrre commented Sep 28, 2022

Is your feature request related to a problem? Please describe.
I'm using go.testOnSave = true.
When I'm saving, the tests are running as expected.
However, the test explorer (the bar/menu on the left side) is not updated.
And the error message in the code are not updated either.

Describe the solution you'd like
When tests are running on save, we should run the tests for the current package from the test explorer.

@gopherbot gopherbot added this to the Untriaged milestone Sep 28, 2022
@hyangah hyangah added the go-test issues related to go test support (test output, test explorer, ...) label Sep 29, 2022
@suzmue suzmue modified the milestones: Untriaged, vscode-go/later Oct 3, 2022
@SAbruzzo
Copy link

SAbruzzo commented Apr 23, 2023

does is work for other languages or it is just a problem for go?

@Form1ca
Copy link

Form1ca commented Feb 7, 2024

still problem
image

@firelizzard18
Copy link
Contributor

vscode-go has two largely independent systems for handling tests: the old one that has most of the features, and the new test explorer implementation. Test on save is a feature of the old system, which is why the test explorer is not updated. I am working on merging the two systems, but the time I can devote to this is limited so it may be a while.

@firelizzard18
Copy link
Contributor

#3523 adds support for VSCode's continuous test runs and will re-execute a test whenever it is updated.

@firelizzard18 firelizzard18 added the Go Companion Issues relating to the Go Companion extension label Oct 3, 2024
@firelizzard18 firelizzard18 moved this to In Progress in Testing UI Renewal Oct 3, 2024
@firelizzard18 firelizzard18 moved this from In Progress to Done in Testing UI Renewal Oct 3, 2024
@firelizzard18 firelizzard18 self-assigned this Oct 3, 2024
@firelizzard18
Copy link
Contributor

@pierrre Would you try Go Companion's explorer and see if it meets your needs?

@firelizzard18 firelizzard18 added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Feb 26, 2025
@pierrre
Copy link
Author

pierrre commented Feb 28, 2025

@pierrre Would you try Go Companion's explorer and see if it meets your needs?

I installed the extension, and I think I see something new in the test explorer.
However it doesn't solve my issue.
When I save my test code (normal code or test), it runs the tests automatically.
But it doesn't show anything in the test explorer: see my screenshot.

Do I need to configure something ?
I tried some settings, but nothing seem to work.

Image

@firelizzard18
Copy link
Contributor

@pierrre It looks like you're still using go.testOnSave; that is part of the legacy testing support which is a separate subsystem that is not and will not be connected to the test explorer. To enable test-on-save for Go Companion's test adapter, you need to click "Turn on Continuous Run" in the test explorer - the icon that looks like an eye. In the screenshot below I've enabled continuous run for TestSimple, indicated by the eye icon being highlighted blue. However, this will only auto-run a test when that test is modified or when a change is made to that file, outside of any of the other test functions (e.g. to a helper function). Ideally it would auto-run a test whenever related code is changed, but "what functions are related to TestX" is not something an extension written in JavaScript can reasonably do (I'd like to add that via gopls but I have a lot of other tasks I want to do first). If you would like different behavior such as "auto-run tests whenever any file is changed", please join the discussion on #3521. I am open to adding a setting for that but I want to cover as many use-cases with as few settings as possible. And you can always submit a PR to Go Companion.

Image

Side note: From your screenshot I can see that you have both the old and new test adapters, from vscode-go and Go Companion, respectively. If you only want to see the new one, either explicitly disable the old one via "go.testExplorer.enable": false or install the prerelease version of vscode-go (which should automatically disable the old adapter).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest Go Companion Issues relating to the Go Companion extension go-test issues related to go test support (test output, test explorer, ...) WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
Status: Done
Development

No branches or pull requests

7 participants