question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Coverage in HTML view is broken

See original GitHub issue

🐛 Bug Report

To Reproduce

Steps to reproduce the behavior: (same as: https://jestjs.io/docs/en/getting-started)

  • Create a new folder
  • Init a new npm project with npm init
  • Add Jest as a dependency npm install --save-dev jest
  • Created a src folder with a main.js file and a main.spec.js test file (one containing sum function and the other the tests as in the Jest docs)
  • Added a test script in package.json.
  • Run the script with npm test -- --coverage
  • When opening the coverage/lcov-report/index.html the HTML does not show the coverage report numbers.

Screenshot

GIT repo here: https://github.com/adyz/jest-coverage-bug-no-ts

Expected behavior

The coverage/lcov-report/index.html should show the actual report numbers

Link to repl or repo (highly encouraged)

https://github.com/adyz/jest-coverage-bug-no-ts

envinfo

npx: installed 1 in 1.36s

  System:
    OS: macOS 10.15.2
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 13.6.0 - /usr/local/bin/node
    Yarn: 1.12.3 - ~/.yarn/bin/yarn
    npm: 6.13.4 - /usr/local/bin/npm
  npmPackages:
    jest: ^24.9.0 => 24.9.0 

Let me know if I should send this to the istanbul.js as well or just there. Not sure where to go from here. I’ve also noticed that on old projects the report is fine until I remove the node_modules and reinstall.

Thanks a ton!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:24 (8 by maintainers)

github_iconTop GitHub Comments

6reactions
SimenBcommented, Jan 12, 2020

Deleting the existing istanbul-reports from your lockfile and re-running npm or yarn should fix the issue. It works in the project I tested, so I think we’re good to go 👍

5reactions
SimenBcommented, Jan 15, 2020

Jest upgraded to istanbul v2 as part of the Jest v24 release (in #7016, to be exact), so upgrading to v24 should fix your issue (as it’ll pull in the fixed version of istanbul-reports@2)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code coverage HTML rendering is broken
Code coverage preview doesn't work in browser. All icons, tables are broken. https://msrasrg.visualstudio.com/NNIOpenSource/_build/results?
Read more >
Jest coverage report in html missing coverage values
As can be seen the numbers are missing. What coud be the reason when the text report has correct values shown as well....
Read more >
Code Coverage - Test Runner - Modern Web
In order to see what is missing we can look at the Coverage Report by Command + Click -ing on the link (coverage/lcov-report/index.html)...
Read more >
Publish code coverage results v1 task - Microsoft Learn
html file. If the code coverage tab fails to show the code coverage report, check whether the size of the index.html file is...
Read more >
How to Generate a Code Coverage Report with CodeCov and ...
Testing prevents you from introducing breaking changes to your codebase ... You can also display a badge showing the coverage report on your ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found