Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jest coverage report in html missing coverage values #9424

Closed
VishalGulati opened this issue Jan 19, 2020 · 5 comments
Closed

Jest coverage report in html missing coverage values #9424

VishalGulati opened this issue Jan 19, 2020 · 5 comments

Comments

@VishalGulati
Copy link

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:

OTPJL

As can be seen the numbers are missing. What could be the reason when the text report in the terminal has correct values shown. It happens only with html report.

@SimenB
Copy link
Member

SimenB commented Jan 19, 2020

Duplicate of #9388

@SimenB SimenB marked this as a duplicate of #9388 Jan 19, 2020
@SimenB SimenB closed this as completed Jan 19, 2020
@YUTZU
Copy link

YUTZU commented May 13, 2020

@SimenB I have followed #9388 step, but still missing coverage value. I knew the issue is istanbul-report version and I tried to upgrade istanbul-report, but when I command npm ls handlebars which still using istanbul-reports 1.5.1. I don't know how can I assign istanbul-reports version for handlebars. btw, jest version is 20.0.4.

@SimenB
Copy link
Member

SimenB commented May 13, 2020

Jest@20 is not supported. To fix this issue I believe you need at least 24. I'd recommend upgrading to the latest 26 release, though

@jianwu
Copy link

jianwu commented Jul 4, 2020

I manually changed to the latest 26 version, even tried yarn upgrade, but the problem is still there. I checked the yarn.lock file, the version is actually upgraded.

Finally, I resolved this problem by running:

yarn upgrade --latest

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants