When I run my tests, both locally and on Travis CI, I get a coverage report, but when the data is sent to codecov (via the codecov package), the report codecov presents is suddenly different. Coverage drops by 10% or so, and the report I see on codecov doesn’t match the HTML report I get running the tests.
(Webpack replace branch specifically, although the reports on the Dev branch never matched either, but the difference was significantly smaller.)
I’ve tried both the codecov NPM package and the bash uploader. Same results.
For example: 5650269188dd66ea59d82a606ec06d9c7fb79ff7, 4e41c95bfa46bcfd655edc2b428f375feb7984bc, b872248dd9f4eaf0d0e6ecca3b8d94b6f04c7af2
Seems to be too long to post here, but you can see it here: https://travis-ci.com/github/sendahug/send-hug-frontend/jobs/390285188#L860
Nothing I can think of.
Hi @shirblc, could you provide the html summary?
Hi @tom, I wasn’t sure how to post it here so I uploaded it to my Drive; I hope it’s okay.
Here’s the link.
Hi @shirblc, thanks for this! I think I figured out why it looks off. The most important thing is that Codecov takes into account branch coverage and does NOT consider a partially covered as hit.
For example, we can take a look at
src/app/components/aboutApp/aboutApp.component.ts. This is what we see in the HTML
Take particular note of the line coverage of 13/13.
In Codecov, we see 13 total lines here too, but 5 are partially covered. Where did they come from?
Digging into the raw lcov.info file, we see
BRDA specific branch coverage. There are 29 statements here (as matches the HTML branches). If you see lines marked with a
0 at the end, it means that branch was not taken as described in the docs (
BRDA:<line number>,<block number>,<branch number>,<taken>)
So what does this mean? Codecov interprets your branch coverage and thus you see coverage seem to be off.