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

Why are reports generated when tests fail? #455

Open
olafurw opened this issue Feb 24, 2023 · 2 comments
Open

Why are reports generated when tests fail? #455

olafurw opened this issue Feb 24, 2023 · 2 comments

Comments

@olafurw
Copy link

olafurw commented Feb 24, 2023

I was submitting a feature request for the vitest project, regarding that generating coverage reports when unit tests fail does not make a lot of sense.

It was noted that tools like c8 do generate reports on failure (vitest-dev/vitest#2908 (comment)) and I was wondering if there was a reason for this.

@celiavelmar
Copy link

I was searching whether any option exists to stop coverage from running if tests fail and I ran into this issue, so I'm co-opting it if you don't mind.

Sometimes coverage report is quite long and scrolling is necessary to know if any tests failed. Is there a way to configure c8 so that coverage does not run if a test did not pass? If not, could I feature-request it?

Thanks! 😃

@raihle
Copy link

raihle commented Feb 8, 2024

I'd also like to see built-in support for this, but it's not that hard to do yourself:

c8 --reporter none -- <test command> && c8 report

The initial run will not print a report, and will fail (as usual) if the test command fails. The second run will print the report, but doesn't run if the first fails.

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