8

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.

1 Answer 1

3

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

Sign up to request clarification or add additional context in comments.

3 Comments

One can use npm list istanbul-reports to see what other libraries are referencing this library, and update those libraries accordingly
@David Lozzi how to upgrade istanbul-reports dependencies
updating istanbul-reports to latest doesnt seem to work. using jest: 23.1.0. node v8.10.0. using legacy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.