ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Coverage support for LCOV?

Open particledecay opened this issue 4 years ago • 6 comments

It seems like a significant portion (majority?) of test coverage tools these days require LCOV format for coverage reporting. I started down the track of writing my own Reporter until I realized that might not do what I'm thinking (lol). Is there any way to get Ginkgo to output coverage metrics into LCOV format, or a way to override the reporting and perhaps build our own?

I currently use gcov2lcov as a GitHub Action in order to ship my LCOV report to CodeClimate. I would love to not have to go through that extra step. As a bonus, packages like coverage.vim would work out of the box with Ginkgo if this output format were supported somehow.

particledecay avatar Apr 16 '21 18:04 particledecay

Ginkgo's using go's coverage support to generate cover profiles. I could imagine first-class support for other formats so long as they can be converted to from go's coverage format. I've improved how coverage reporting works in V2 and could imagine adding this as an additional flag/option (e.g. -cover-format=lcov). after v2 ships. But given there is tooling that exists already I'm inclined to put it lower on the priority list...

onsi avatar Apr 16 '21 19:04 onsi

I'm using https://github.com/jandelgado/gcov2lcov now which is fine. It would be nice if I can configure ginkgo to automatically invoke commands after testing so lcov get generated immediately after running the tests. Especially when running ginkgo watch this could be helpful.

munnik avatar Apr 24 '21 08:04 munnik

I am planning on adding LCOV format support in v2. You can get Ginkgo to invoke commands after every test run already - check out --afterSuiteHook.

onsi avatar Apr 24 '21 12:04 onsi

I am planning on adding LCOV format support in v2. You can get Ginkgo to invoke commands after every test run already - check out --afterSuiteHook.

Thanks! That works great.

munnik avatar Apr 25 '21 12:04 munnik

@onsi did this ever happen? Funny enough this thread is the top result when you search "ginkgo lcov" (which I ran into again and came across my own thread :laughing:)

particledecay avatar Apr 08 '22 00:04 particledecay

hey there - sorry, it never ended up happening. I ran out of steam near the end there and couldn't pull together native lcov support. Open to accepting a PR and happy to point the way but I don't think I'm going to have time to do this myself anytime soon :/

onsi avatar Apr 08 '22 15:04 onsi

I'm going to close this issue for now. If there's interest in submitting a PR let me know and we can reopen it.

onsi avatar Nov 16 '22 03:11 onsi