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

Add lenses for ginkgo to run specific tests #228

Open
vincepri opened this issue Jun 16, 2020 · 3 comments
Open

Add lenses for ginkgo to run specific tests #228

vincepri opened this issue Jun 16, 2020 · 3 comments
Labels
go-test issues related to go test support (test output, test explorer, ...) NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.

Comments

@vincepri
Copy link

If you have a question, please ask it on the #vscode or #vscode-go channels in Gophers Slack](https://invite.slack.golangbridge.org/messages/vscode).

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

Ginkgo is a widely used BDD testing framework, which is used to describe individual specs. Ginkgo also offers cli options that are added when you run go test which can be leveraged for lenses.

Describe the solution you'd like
Today, vscode offers a way to run individual go tests as shown in the picture below.

image

It'd be great to have the same functionality on each ginkgo-spec using its name as input to ginkgo.focus flag when running the go test command.

Describe alternatives you've considered
The only other way to run ginkgo individual tests today is to run the tests from the command line.

Additional context
Happy to help with coding a solution up given enough guidance.

@hyangah
Copy link
Contributor

hyangah commented Jun 16, 2020

There is a similar feature request to support gocheck.
#111
Also, support for testify landed in microsoft/vscode-go#1707.

How many of test frameworks do we want this extension to support?
How can we keep the extension up-to-date with all the changes in the test frameworks?

I wonder if we can come up with another way - For example, make the Go extension export an api for code analysis (e.g., proxying symbol lookup requests), so other extensions can retrieve information necessary to implement their own codelenses.

cc @stamblerre @ramya-rao-a

@hyangah hyangah added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Jun 16, 2020
@ramya-rao-a
Copy link
Contributor

If there are more and more test frameworks to contend with, then I would recommend separate extensions for these.

What is required for codelens for any test framework is

  • ability to get list of all functions in the file, with name, function signature and position in the file
  • determine which of these functions need to get a codelens
  • run the appropriate test command with the right input
  • parse the output to convert relative links to absolute links so that failed tests with pointers to code are clickable in the test output

The first step is doable by shelling out to tools like go-outline. The symbol provider in the Go extension can be used as reference.

The second and third step is specific to the framework being used.

The last step is optional. If needed, one can refer the parsing logic used in the Go extension.

@vincepri
Copy link
Author

Thank you all for the context. It seems like the best path forward is definitely to have a separate extension that can work together with vscode-go. Initially, I opted to open a new issue here given that testify is supported alongside normal go tests.

Ginkgo is used extensively in the Kubernetes community, I figure I'd bring this up and gather information and see how to proceed.

@gopherbot gopherbot added this to the Untriaged milestone Apr 8, 2021
@stamblerre stamblerre modified the milestones: Untriaged, Backlog Apr 9, 2021
@hyangah hyangah added the go-test issues related to go test support (test output, test explorer, ...) label Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go-test issues related to go test support (test output, test explorer, ...) NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made.
Projects
Status: No status
Development

No branches or pull requests

5 participants