v8-to-istanbul icon indicating copy to clipboard operation
v8-to-istanbul copied to clipboard

Merging multiple converted coverage reports together for the same file results in a mismatch between the number of properties in `branchMap` and `b`.

Open JustinChristensen opened this issue 3 years ago • 1 comments

I'm not really sure what the expected behavior here should be. I'm using Playwright to run tests and extract coverage reports from V8 for the same test run, and to then convert and merge them together using a coverage map (from istanbul-lib-coverage). .

v8-to-istanbul appears to only have branches that were covered in the v8 coverage report in it's branchMap. This causes the final merged coverage map to have a mismatch between the number of branches in the branchMap and the b hit counters, because of the way that FileCoverage merge is written.

Whether this should be fixed by making that merge routine (mentioned in the linked issue) smarter, or making v8toistanbul attempt to get all (including uncovered branches) in the branchMap for a given file, I can't say for sure.

JustinChristensen avatar Jul 03 '21 05:07 JustinChristensen

@JustinChristensen one problem is that v8 output won't necessarily have all the same branch information, as it collapses together consecutive blocks.

I think this problem might be better solved by merging together the reports while they're in v8 format, which is what happens here.

The conversion from v8 to istanbul is a bit lossy (due to the merging) so I think it's challenging to solve at that layer.

bcoe avatar Sep 07 '21 20:09 bcoe