2

In the project I use playwright to test most of the code. I added jest to test some specific util stuff directly. Playwright and jest generate a json test coverage report which I want to combine to show the total coverage as a HTML report. I managed to merge the two reports and the coverage values seem to be correct. But the function coverage is off. Before adding jest it showed 16/16 Functions covered with 100 % now it shows 17/34 and 50% after adding the jest tests.

I use the following commands to merge my reports:

    npx nyc merge ./coverageReports/ merged-output/result.json
    npx nyc report --reporter=html --reporter=text -t merged-output/

Now I would expect the HTML report to look something like this: Code coverage with only one report

But my coverage looks like this: Code coverage when reports are merged

The rest off the report looks correct and for files where I only have tests for one of the tools it works as expected. Utilities is currently the only file with playwright and jest tests covering functions. But this will change when more jest tests are added. Is there a way to get correct numbers in this case as well?

Basti
  • 449
  • 2
  • 13

0 Answers0