vscode-go
vscode-go copied to clipboard
Additional `go.testFlags` setting for single-test runs
Is your feature request related to a problem? Please describe.
I'd like to provide a certain test flag — -v — when I run a single test in my project, but not when I run batches of tests (e.g. all the tests in a file, or all the tests in the project).
In particular, I want this for tests triggered by
- The inline run test link in the editor
- The "Test: Run Test at Cursor" command palette entry
Describe the solution you'd like A clear and concise description of what you want to happen.
An additional setting — let's say go.singleTestFlags — with the same structure as the existing go.testFlags setting.
In run.ts, run and debug can switch on the details of the received TestRunRequest (cardinality of request.include). If only a single test is explicitly included, append the go.singleTestFlags to the go.testFlags.
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
- Verbosity is actually the only flag I want to differ between single-test and multi-test runs. Maybe a dedicated single-test verbosity boolean setting, rather than a more complex set of flags, would be easier to implement/document.
Additional context Add any other context or screenshots about the feature request here.
Given these example settings:
{
"go.testFlags": [
"-tags",
"manual"
],
"go.singleTestFlags": [
"-v"
]
}
- When I "Run Tests in Current File," they should run with
go test -tags manual {selector}. - When I "Run Test at Cursor," it should run with
go test -tags manual -v {selector}.
The ability to run tests without -v will eventually be removed. Long term all testing support will be migrated to use the vscode testing API/pane and that can't function without -v.