mweibel/lcov-result-merger

Branch mismatch

Opened this issue · 0 comments

I use nyc to test nodejs and karma-typescript to test browser and merge the result with lcov-result-merger.
the line coverage report is correct, but the branch coverage report are not

there are 2 issues.

  1. nyc block id starts with 0 : BRDA:29,0,0,8, but karma-typescript starts with 1 : BRDA:29,1,0,8. so they are completely mismatched and creates lots of extra branches in the report
  2. different compiling setting may cause some branch to disappear due to compiler optimization, so 2 report might have different number of branches, and in that case block id are also mismatched.

my work around is to unify block id base on the current source line instead of current source file, so every time BRDA reach a new source line, it reset block id to 0 .

my script to unify the block id:
https://github.com/ticlo/ticlo/blob/master/tool/unify-lcov.ts

this should solve most of the issues.
I guess it's still possible that even in same line, one compiling setting may finds 3 branches and the other finds only 2 branches. in that case it's just impossible to merge correctly since lcov doesn't have the information of the begin and end of a branch