Reputation: 613
I used to see "Run Test | Debug Test" links top of every test function in VS Code for Go. But they are missing now. How can I re-enable them?
This picture shows what I am talking about:
Upvotes: 5
Views: 27205
Reputation: 1
I have managed to fix it. The problem was on pom.xml's java settings. The java version I am using is 17 not 1.7 and I changed the setting in pom.xml to 17. And voila!
Upvotes: -2
Reputation: 29
In addition to restating OmniSharp, you might want to make sure the right solution is selected. Ctrl + Shift + P > select OmniSharp: Select Project > select the correct .sln file for your solution
Upvotes: -1
Reputation: 613
I have this situation when there are many folders in the project I opened in VScode. But these options appear only when I open the folder containing the script I want to run the test in in a new window in VSCode. I don't know why, it's weird.
Upvotes: 0
Reputation: 1349
This happened to me, though I was writing Javascript
(not Go
).
To fix that, I need to make sure the Es6 import
& export
statements are correct (-- correctly importing the correct item
from the correct file path
),, -- for this current test js file
& relevant imported js files
(or even all files in current project).
(Then you must save the test js file
to refresh it.)
The Test Explorer
's Output
panel may(?<) throw an Error to indicate that.
Upvotes: 1
Reputation: 497
Same thing here - simply closed down VS Code and opened it back up again... they all appeared once more.
Upvotes: 0
Reputation: 490
Had the same issue today. In my case opening the Command Palette (Ctrl+Shift+P) and running "OmniSharp: Restart OmniSharp" fixed it.
Upvotes: -1
Reputation: 55
Taken directly from the go.dev doc for the testing
package
Please ensure that your test file name ends in _test.go
, and that the function you're trying to test starts with Test
(like it does in your snippet).
Upvotes: 2