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

Support for c8 code coverage as an option #588

Closed
mikeybinns opened this issue Aug 28, 2022 · 3 comments
Closed

Support for c8 code coverage as an option #588

mikeybinns opened this issue Aug 28, 2022 · 3 comments

Comments

@mikeybinns
Copy link

Is your feature request related to a problem? Please describe.
Code coverage using istanbul / nyc requires implementing an extra build step to instrument your code, but c8 uses native V8 coverage metrics in any version since Node.js >= 10.12.0, which doesn't require instrumenting your code.

Describe the solution you'd like
Support for using coverage reports generated only using c8, removing the need to install istanbul and nyc into the build tool.

I believe this is possible as an option because vitest supports both istanbul and c8 via different coverage plugins, so theoretically, it's possible. That being said, I am not well versed on coverage tools, so it's entirely possible I'm asking for the moon here, let me know if that's so.

Also, based on the fact that cypress doesn't load the code for you, you must start your own server, this could mean that it requires starting the server with c8 to ensure it's generating the reports needed by cypress, but as long as cypress can read the reports, and documents that the server must be started a certain way, I don't see this as an issue.
e.g. my app is a remix app, so I'd have to load the app using c8 remix dev instead of remix dev for this to work.

@mikeybinns
Copy link
Author

Closing as invalid, I've just seen that this (or the general premise of removing Istanbul installation) is being worked on.
Source: https://docs.cypress.io/guides/tooling/code-coverage#Future-work

@mikeybinns mikeybinns closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2022
@murdos
Copy link

murdos commented Sep 21, 2024

For reference, the future work section in the documentation has been removed (cypress-io/cypress-documentation@280dccb) so this is unfortunately not planned anymore.

@parkuman
Copy link

parkuman commented Jan 27, 2025

Hi all. After an email exchange with @jennifer-shehane she confirmed to me that there were no more plans to implement c8/v8 coverage for Cypress from the internal team and the commit linked above was created to remove it.

Since then, I was working hard to make this work. I'm happy to say I have an initial working package published to NPM for V8 code coverage support for Cypress!

NPM: https://www.npmjs.com/package/cypress-code-coverage-v8
Repo: https://github.com/parkuman/cypress-code-coverage-v8/

We have been using it internally at our company for our Vite + React application for over 6 months and it has served us well. Please take a look and let me know what you think! The ultimate goal would be for this to be an official Cypress plugin :)

have sparked a new discussion here to maybe get the ball rolling: #925

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants