Skip to content
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

Additional go.testFlags setting for single-test runs #3671

Open
lukasschwab opened this issue Jan 28, 2025 · 1 comment
Open

Additional go.testFlags setting for single-test runs #3671

lukasschwab opened this issue Jan 28, 2025 · 1 comment

Comments

@lukasschwab
Copy link

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}.
@gopherbot gopherbot added this to the Untriaged milestone Jan 28, 2025
@firelizzard18
Copy link
Contributor

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.

@ansaba ansaba modified the milestones: Untriaged, vscode-go/backlog Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants