gotestsum icon indicating copy to clipboard operation
gotestsum copied to clipboard

generate coverage reports

Open bstpierre opened this issue 1 year ago • 2 comments

@dnephin commented in @302 in a discussion about coverage output:

go tool cover (https://pkg.go.dev/cmd/cover) is a similar idea. It can produce 2 reports: coverage percentage per function, and a detailed HTML report. The HTML report effectively has this information, but it's not presented this way.

It seems like it wouldn't be too difficult to copy and modify https://cs.opensource.google/go/go/+/refs/tags/go1.20.3:src/cmd/cover/html.go to make a new report in the format you want. It is possible there is a tool out there that has already done the work, I haven't looked. If you want to build it, it could work as gotestsum tool cover-report or something similar. A new issue for this would be great.

I use coverage reporting in CI, and GitLab's coverage visualization requires cobertura format. I'm currently using gocover-cobertura to generate this report. It would be handy to be able to generate both the junit and cobertura reports from gotestsum all at once -- possibly alongside the html output that was mentioned in the comment that dnephin was replying to.

bstpierre avatar Jun 09 '23 12:06 bstpierre