-
Notifications
You must be signed in to change notification settings - Fork 0
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
Code coverage in editor #31
Comments
Unfortunately there is no standard for coverage reports or interface to generate those similar (or reusing) the debug adapter protocol. The most reliable solution is using kcov by parsing the The biggest unsolved question for a very convenient experience is the missing build system integration for emitting/lookup of debug symbols of projects and their build+link dependencies, which need per-project setup. However this does in no way block parsing and visualising the |
I think cobertura report is semi-standard. I would say that most tools I am familiar with can generate it. On top of that Gitlab accepts it. Jenkins has plugin for it. For a fairly comprehensive list of other formats in the wild, CodeCov documentation lists several several of them. I'd go for it, although it's an XML format, so no vim native parser is available. I think that it shouldn't be plugin's job to emit coverage. For me, it would very much acceptable if I just could configure plugin to expect coverage report is some place, and read it whenever it is (re)generated. I can see how generation being managed by plugin would be convenient, but it's a serious undertaking. Perhaps coverage plugin should be companion to full-blown testing plugin like https://github.com/vim-test/vim-test. Another feature besides visualization I didn't mention before is an option to open list of covered files in quickfix/Telescope/other solution for quick navigation over files included in report. |
Not familiar with it but looks like the project is dead. Last official release was in 2015. cobertura/cobertura#400, cobertura/cobertura#418 Or were you just referring to the format used for the coverage report? |
Yes, I was talking about format they created. For testing java code I was once using jacoco, which admirably didn't support generating cobertura format at the time, but I found python script that could convert between jacoco own XML format into cobertura format that could be processed further. |
If its of any help, I wrote an LSP plugin for Solargraph (ruby lsp) that provides realtime line-by-line coverage: Might serve as inspiration. |
Thank you, I've added it to the list. |
What?
Seeing which lines in currently opened buffer are covered by tests. Many IDEs provide that. Below are few examples:
Why?
It helps tremendously during writing tests. Most coverage plugins allow exporting report as HTML, but it's tedious to navigate and switch context.
Potential existing implementations:
Potential pitfalls:
In the simplest scenario, plugin should be able to show which lines are covered. Some coverage tools provide additional information, e.g. branch coverage, which is more difficult to present (I saw this reported with yellow background colour, and perhaps popup could be displayed with further details on CursorHold). As for visualization, I think plugin should at least allow choosing between highlighting whole lines and using signs. Perhaps virtual text could be also used as third method. There are few report types, from my own experience many tools know how to generate report in cobertura XML format.
The text was updated successfully, but these errors were encountered: