Search code examples
reactjsunit-testingjestjscode-coverage

Jest coverage report in html missing coverage values


I am unit testing my ReactJS app with Jest and have added configuration to get the code coverage. The coverage works well on cli but when I try to export coverage report as html the values corresponding to each file are not shown in the report. Here is my jest.config.json:

{
    "roots": [
        "test"
    ], 
    "collectCoverage": true,
    "coverageReporters": ["text","html"],
    "coverageDirectory": "<rootDir>/coverage/"
}

And here is my report generated in coverage folder inside index.html file:

enter image description here

As can be seen the numbers are missing. What coud be the reason when the text report has correct values shown as well. It happens only with html report.


Solution

  • I had this as well. Updating the package istanbul-reports to the latest version (3.0.0 at the time) fixed the issue.