-
-
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
Error when merging Jest coverage using nyc #9808
Comments
Is there any known workaround? Example Result from jest ("jest": "^26.4.2"): Example Result from Cypress/NYC: |
Ok - using this workaround: #2418 |
accidentally closed |
@tobiasgrossmann Thanks for the heads-up about this solution. Unfortunately when generating html reports and viewing them shows stack traces on multiple files. Like this one:
|
For anyone that gets here and is using After excluding those files from coverage reporting the |
If it might help anyone, here's what I ended up doing (probably not a great solution, though 😅 ): The code coverage report generated by Jest, when utilizing In my
But this didn't cover all cases, so I ended up writing a tiny script that stripped the Screenshot example below (coverage-final.json), |
@postmodernistx thanks, with your comment I got it fixed! In my case HTML files were the troublemakers and I could fix it by adding this to coveragePathIgnorePatterns: ['/node_modules/', 'src/(?=.*\\.html$)'] |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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
I'm using nrwl's nx with angular, jest and cypress. For unit test code coverage reports I execute
npm run test -- --code-coverage
and the report looks good when opening. Now I'd like to use nyc to merge this report with the one generated from cypress. Running nyc merge runs fine on the cypress coverage json, but on Jest's I getInvalid file coverage object, missing keys, found:data
When I look in the coverage-final.json file from Jest, I do see html objects containing data properties, while the .ts objects have keys properties. The cypress coverage-final.json output has html objects containing keys properties, which leads me to believe the problem is with the way Jest outputs coverage under certain circumstances. Possibly it's an Istanbul issue, but I'm posting it here as it seems Istanbul's nyc, that uses the same version of Istanbul as Jest is not able to process the coverage files.Also worth mentioning, with Jest 24 the coverage-final.json didn't contain data properties in html entries.
To Reproduce
Not able to reproduce using a minimal setup.
Expected behavior
No data properties to be present on file objects in coverage-final.json.
Link to repl or repo (highly encouraged)
I created a small setup but there the data properties on the .html files somehow were not present. So at the moment I am unable to reproduce outside of the environment this is happening.
envinfo
The text was updated successfully, but these errors were encountered: