-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Coverage in HTML view is broken #9388
Comments
This seems like a bug in istanbul somewhere, as the text reporter works correctly. @coreyfarrell have you seen this before? Note that it works correctly on Jest master (which is using the new major of istanbul deps) |
diff --git i/package-lock.json w/package-lock.json
index 4ae4388..9e5ba91 100644
--- i/package-lock.json
+++ w/package-lock.json
@@ -2186,9 +2186,9 @@
"dev": true
},
"handlebars": {
- "version": "4.6.0",
- "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.6.0.tgz",
- "integrity": "sha512-i1ZUP7Qp2JdkMaFon2a+b0m5geE8Z4ZTLaGkgrObkEd+OkUKyRbRWw4KxuFCoHfdETSY1yf9/574eVoNSiK7pw==",
+ "version": "4.5.3",
+ "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
+ "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
"dev": true,
"requires": {
"neo-async": "^2.6.0",
diff --git i/package.json w/package.json
index 901fec3..2971de5 100644
--- i/package.json
+++ w/package.json
@@ -9,6 +9,7 @@
"author": "",
"license": "ISC",
"devDependencies": {
+ "handlebars": "~4.5.3",
"jest": "^24.9.0"
}
} |
I've quickly opened up handlebars-lang/handlebars.js#1636 upstream linking back to this issue for the reproduction |
I've pushed the Publishing this to npm is difficult for me as it's not possible to publish under the npm I'd appreciate anyone who has the time to manually test my patch. Due to istanbul-reports being in a monorepo it's not possible to have npm install directly from git, the following process must be followed:
I've done this already with the self-tests of nyc@14.1.1 and it seemed to work but I'd like to get some confirmation before I can publish this fix to npm. |
Hi @coreyfarrell, I've followed your steps it seems to work well with the repo posted on this issue: https://github.com/adyz/jest-coverage-bug-no-ts
Thanks a ton! |
Actually, I've tried to add my changes on a separate branch on my repo and the HTML it's not working anymore... I'll try again this weekend alt will let you know... sorry for the false positive |
Thanks for testing, istanbul-reports gets 6+ million downloads per week so releasing a broken version would bombard me with reports (I suspect many people are not seeing this handlebars bug due to package-lock files). I'm going to give this a little time to hopefully get a couple more testers before I publish (I'm also still fighting with CI for the istanbuljs repo itself). |
BTW you'll want to remove |
Yes, typo, sorry. Not sure what is happening with my machine that first time worked and the second time did not. Definitely wait a bit more before release and more tests. |
In the case where it fails what does |
Sorry for the late response @coreyfarrell
Not sure what was the desired version. I've created a branch here with the changes: I hope it helps! Thank you! |
Yes this helps, istanbul-reports@2.x already had a backport that didn't get merged into master and I forgot about, so my patched copy of istanbul-reports@2.2.5 wasn't being used by jest. I've pushed a couple more commits, please |
Wuhu! Works! The HTML is generated 🥳 |
Pushed the changes and the newly generated package here: https://github.com/adyz/jest-coverage-bug-no-ts/tree/test/local-istanbul |
Let's keep this open for visibility until a new version of |
@adyz thanks for the update. No further testing is needed. I'm planning to release a new version of istanbul-reports@2 soon. Will comment again when that is complete. |
istanbul-reports 2.2.7 is now published to npm. Can anyone confirm this fixes the issue as experienced by jest users? |
Deleting the existing |
I've posted this bug for a project that now is working perfectly! I've removed the Thank you! |
Coverage in HTML view is broken. |
@springfred istanbul-reports@1.5.1 is no longer maintained (current version is 3.0.0). The best fix is to upgrade your dependencies so istanbul-reports@2.2.7 or above is used. If this is not an option you will need to pin handlebars in your own package.json to 4.5.3 then perform a fresh |
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) |
hello everyone's why not working this code.
|
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. |
🐛 Bug Report
To Reproduce
Steps to reproduce the behavior: (same as: https://jestjs.io/docs/en/getting-started)
npm init
npm install --save-dev jest
src
folder with amain.js
file and amain.spec.js
test file (one containing sum function and the other the tests as in the Jest docs)package.json
.npm test -- --coverage
coverage/lcov-report/index.html
the HTML does not show the coverage report numbers.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 numbersLink to repl or repo (highly encouraged)
https://github.com/adyz/jest-coverage-bug-no-ts
envinfo
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!
The text was updated successfully, but these errors were encountered: