-
Notifications
You must be signed in to change notification settings - Fork 17
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
feature: ginkgo support #204
Comments
Hey @hown3d, I haven't used ginkgo and I don't plan on adding this support myself but I'm absolutely open for PRs here and I'll be happy to provide guideance. I'm curious what steps you took to get the tests to be detected in your screenshot, and if you only got the test summary to show the tests - but not being able to run them, for example. Have you looked at how the optional testify feature was implemented? After having quickly skimmed the ginkgo link you provided over morning coffee, it looks like the test output will be I'm looking into potentially supporting custom test runners in #189 which perhaps could be interesting here, in case it would help to use |
Happy to participate! I've been playing around to get support for Ginkgo tests. The tests from the screenshot are done using this Tree-sitter query:
Test executionI was thinking about using the focus flag from ginkgo which focuses on a dedicated Spec with regex. This is only suitable though when actually targeting a ginkgo Spec. Using the tests from the screenshot as an example: ginkgo run --focus "Books Categorizing Books with more than 300 pages should be a novel" This focus "regex" does differ though from the go test regex. So if using ginkgo as the runner, we would need to distinguish between standard go tests and Ginkgo specs, which is not possible (correct me if I'm wrong) not possible from the same adapter. Test parsingUnfortunately Ginkgo does not use the default test output from go json instead it uses it's own data structure for reports. ConclusionMy idea was to create a second adapter that is only used to parse Ginkgo specs. There we can adapt to different regex invocation and result parsing. |
Given if I merge in something like #189 you could actually implement all this here in this adapter. But it sounds like you won't benefit much from doing that in case everything differs (treesitter query, execution command, test output parsing). Then maybe it's better you take ownership of this and build a separate adapter, as you wouldn't be "trapped" in my repo and in the way I structure the code etc. |
@hown3d Slowly I have been working on that https://github.com/nvim-contrib/nvim-ginkgo |
Did you check docs and existing issues?
Is your feature request related to a problem? Please describe.
Ginkgo does have it's own structure on how test cases are build: https://onsi.github.io/ginkgo/#writing-specs
Some places where ginkgo is used:
Requirements to support ginkgo
Describe the solution you'd like to see.
Add a tree-sitter query to capture tests written with Ginkgo
Describe alternatives you've considered.
Ginkgo has the possibility to print it's outline with
ginkgo outline --format=json $PACKAGE
in their own data structure.For example the
Parsing this into neotest.positions would be possible, but using native treesitter seems to be the easier option.
Additional context
I would be happy to implement support since we use ginkgo a lot in our code base 😃
The text was updated successfully, but these errors were encountered: