Search code examples
githubcode-coveragecodecov

How to show green/red colors in Github PRs showing code coverage


Codecov has data for my repository's code coverage, and the report it shows is useful, e.g.

actual

But it would be much more useful if I can show code coverage in the /files page when looking at a PR on Github itself, i.e. something like this:

expected

According to Codecov docs, there used to be a Google Chrome extension (Sourcegraph) that added the color overlay, but it was deprecated in September 2022.

https://docs.codecov.com/docs/browser-extension https://github.com/codecov/sourcegraph-codecov/blob/master/README.md Sourcegraph extensions have been deprecated with the September 2022 Sourcegraph release. Learn more.

So, how can I accomplish what I want? I like the inline coloring because it lets me know immediately if the PR tries to merge code that isn't covered. With my current setup I need to look at the codecov report.


Solution

  • Tom from Codecov here. Although the Sourcegraph extension is deprecated, we are currently working on bringing back a browser extension to do this. The project is open-sourced here if you want to follow along.

    We are planning to launch sometime by the end of this year.