golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.8k stars 730 forks source link

Allow setting the file as test target rather than the package #3127

Open viocha opened 6 months ago

viocha commented 6 months ago

Is your feature request related to a problem? Please describe.

When I tested a function, it failed and reported errors from the package. I observed that it utilized the command go.exe test -timeout 30s -run ^TestIntMinBasic$. If I append the filename to the command, as in go.exe test -timeout 30s -run ^TestIntMinBasic$ .\unit_test.go -v, it runs successfully. Goland doesn’t report this error since it supports the test kind “file”. I hope that the vscode plugin could also allow the configuration of the test kind or run kind to “file”.

image image image

Describe the solution you'd like

Describe alternatives you've considered Append the file name to the test command

Additional context https://www.jetbrains.com/help/go/run-debug-configuration.html#list-of-fields-in-go-build-configuration