fdesjardins / coverage-viewer

A cross-platform code coverage report generator
MIT License
16 stars 4 forks source link

Cannot generate coverage report with output from Coverlet 2.5.1 #9

Closed lshearer closed 5 years ago

lshearer commented 5 years ago

Using the current most recent version of coverlet (via coverlet.msbuild NuGet package version 2.5.1) and coverage-viewer (version 0.3.0), an error is thrown when generating the coverage report:

/Users/lyleshearer/.npm/_npx/78321/lib/node_modules/coverage-viewer/lib/statistics.js:22
    line => line.stats.find(stat => stat.name === 'Hits').value !== 0
                                                         ^

TypeError: Cannot read property 'value' of undefined

This can be repro'd by cloning and running this script on a fork of the coverlet repo.

This appears to be because the coverlet output format for coverage.json changed, perhaps when support for branch coverage was added. The format of the test asset is quite different than the one generated during that repro test.

fdesjardins commented 5 years ago

Interesting, thanks for the write up and repro script. Glancing at the new format, you're right it does look very different. I'll take a closer look at supporting the new format in the next couple days.

fdesjardins commented 5 years ago

Well, I took a look a couple days ago and it actually doesn't look too bad. The main issue is with the new lines format. I'll try to clean this up and cut a new release this week.

fdesjardins commented 5 years ago

@lshearer Sorry for the delay. I just published a new version 0.4.0 that should resolve this issue. Let me know if you still have any issues. Thanks again for the bug report.