eugenezinovyev / lcov-viewer

LCOV code coverage report viewer. Parses lcov report files and generates HTML report grouped by directory.

Home Page:https://lcov-viewer.netlify.app/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CLI conversion option

selfagency opened this issue · comments

Thanks for making this! I have a unique use case. I use a test runner that splits up and parallelizes my test suites so that they run faster. But this means, at the end, I have to merge the coverage reports back together. Unfortunately, this means I have to manually generate the HTML report at the end of the merge, rather than during the test runs' report generation step. I was using your tool before switching to this test runner and would love to be able to keep using it, if I could just feed an lcov.info or lcov.json file into it and get back out the HTML report, similarly to the way your website works.

Oh, thank you! I literally thought nobody is using this package except me. Sure, CLI option is next target in my list. I expect to have it published this week. Will drop a note here to notify you.

@selfagency, I've published a seprate CLI package: https://www.npmjs.com/package/@lcov-viewer/cli

After installed it can be used as following (assuming you have lcov.info flie in working directory):

lcov-viewer lcov -o output-dir lcov.info

It will create an "output-dir" directory with HTML report files inside.

Have fun! :)

Thanks so much!

Hi @eugenezinovyev, thank you for this tool! I have pretty much the same situation, I'm using jest and cypress to generate coverage results, and then I want to merge them to get the total result. I guess I can use existing tools to merge them into a single lcov.info file, but I'm wondering how I can make it work to be able to view file state (covered/not covered lines, branches, etc.). Any suggestions?

Edit: I just tried one approach that does not work for me when I use existing cypress reporters (they show incorrect merged data) - I placed all (x/y/z)-coverage.json files inside one folder and ran the nyc report command with your reporter, and the result seems to be correct! The command - nyc report --report-dir coverage/merged-report --temp-dir coverage/grouped --reporter=@lcov-viewer/istanbul-report