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

Feature request: add branch coverage option for lcov formatter #389

Open
ArSn opened this issue Mar 2, 2019 · 1 comment
Open

Feature request: add branch coverage option for lcov formatter #389

ArSn opened this issue Mar 2, 2019 · 1 comment

Comments

@ArSn
Copy link

ArSn commented Mar 2, 2019

I am running code coverage reporting for JavaScript with the lcov formatter by using Istanbuls nyc CLI tool as is explained in the docs. While this works just great with the test reporter as it supports lcov, the test reporter is reporting the percentage of lines that were covered by running the tests.

However, some people (like me) would rather like to have the branch coverage reported as a percentage, in order to be even more thorough with their test coverage. To make this possible, it would be great to add an option to make the test reporter do just that.

As far as I understood by the geninfo manpage for lcov, the branch data is in the lcov.info file with the BRDA, BRF and BRH prefixes, which is already created by nyc.

That being said, I presume that the requirements to achieve this are already available and it would "only" have to be implemented in formatters/lcov/lcov.go.

@wfleming
Copy link
Contributor

wfleming commented Mar 4, 2019

Altering the lcov formatter in this repo might be technically sufficient to report only branch coverage to our API, but I'm not sure that would result in very useful behavior with the test coverage results on our site. The trend charts we display and per-file test coverage information we display on the site were all built with line-by-line coverage in mind, without regard to what any particular line means. That said, it might be acceptable for you if you're ok with some of the displays on the site using the test coverage data perhaps seeming a bit off.

This might actually be cleaner to implement as a separate script rather than plumbing all the necessary pieces through the test-reporter. Have you considered protoyping this as a preprocessing script that would remove non-branch information from the lcov.info and reformatting the branch-focused prefixes to the prefixes we normally look for? If you did that and tried it I think you might be able to get what you're after and see how it would work with our website.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants