ryanluker / vscode-coverage-gutters

Display test coverage generated by lcov and xml - works with many languages
https://marketplace.visualstudio.com/items?itemName=ryanluker.vscode-coverage-gutters
MIT License
460 stars 88 forks source link

Partial Coverage Calculation Only on Path 0 #131

Closed hunterjm closed 6 years ago

hunterjm commented 6 years ago

Is there a particular reason Coverage Gutters only marks lines as partially covered when the else path, or path 0 has no hits? Shouldn't it check that all paths for the branch condition have hits and mark it as partial if any of them do not?

ryanluker commented 6 years ago

@hunterjm thanks for submitting this issue! Are you able to reproduce this with the example projects that are in this repository? I am working on the 2.0 architecture currently and I am getting correct looking coverage for the partial lines (based on my understanding). screenshot from 2018-05-03 08-59-49

Let me know if you can reproduce the issue or give me a way to reproduce it and I will gladly take a look at it :+1: .

hunterjm commented 6 years ago

@ryanluker - I see the same code in your arch revamp branch. It's this line: https://github.com/ryanluker/vscode-coverage-gutters/blob/117-arch-revamp/src/renderer.ts#L104

The issue is when the LCOV reports 0 hits on path 1 (branched path), but 1 or more on path 0 (default path). It's showing the same issue on Line 32 of the node example. The LCOV file says path 0 was taken and path 1 was not, but the line shows fully covered: https://github.com/ryanluker/vscode-coverage-gutters/blob/117-arch-revamp/example/node/lcov.info#L101

test-coverage js node 2018-05-04 14-20-06

It shouldn't matter which path is reporting 0 hits, if any BRDA for the same line number is reporting no hits, it should be marked as partially covered.

ryanluker commented 6 years ago

@hunterjm ahh I see now thanks for the extra info, I will fix this in the 2.0 release 😄

ryanluker commented 6 years ago

@hunterjm did a first pass on this one and I am definitely getting "more" correct results I believe :smile: . screenshot from 2018-05-06 08-23-50 I fixed this in the 2.0 branch and added test coverage to watch for this in the future, let me know if the coverage still looks out of wack and I can do some tweaking! https://github.com/ryanluker/vscode-coverage-gutters/pull/126/commits/eefce5dc24340a717b8a5c5727a14d87e2b51756

ryanluker commented 6 years ago

@hunterjm closing this one for now but I did include eefce5d in the upcoming release (you can also find the .vsix file in the tag release if you want to see it early).