Skip to content

Add SummaryReporter for vitest #76

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

Merged
merged 1 commit into from
Apr 25, 2025
Merged

Add SummaryReporter for vitest #76

merged 1 commit into from
Apr 25, 2025

Conversation

acelaya
Copy link
Contributor

@acelaya acelaya commented Apr 24, 2025

This PR adds a SummaryReporter for projects using vitest, which extends the default reporter but suppressing the output generated at the end of every file.

That output was a bit annoying for us, since we pre-bundle a single test file, causing a big chunk of output to be printed at the very end of the test execution.

Since not all projects are using vitest yet, this PR also defines vitest as an optional peer dependency, and exposes vitest-related symbols from a new @hypothesis/frontend-testing/vitest entry point.

@acelaya acelaya requested a review from robertknight April 24, 2025 08:14
@acelaya
Copy link
Contributor Author

acelaya commented Apr 24, 2025

I tested these changes via yalc and seems to be working properly.

Copy link
Member

@robertknight robertknight left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a comment with an example of the output using the DefaultReporter versus this new reporter for a repository where we've enabled Vitest? Also I had a query about how the changes here relate to the BasicReporter.

@@ -0,0 +1,11 @@
import { DefaultReporter } from 'vitest/reporters';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that Vitest also has a BasicReporter. How does the output from that differ from what we're doing here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The basic reporter is the same as the default reporter, but with the summary disabled. Basically the opposite of what we want.

Copy link
Contributor Author

@acelaya acelaya Apr 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my bad. The basic reporter seems to be the same we want, except that it does not print the progress in real time, only at the end.

basic-reporter-2025-04-24_10.54.48.mp4

That makes me think that the summary is not what I have been calling "summary", but the output from every file. Perhaps we should find a better name for our reporter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the discussion here, it seems what we want is in fact the summary, so SummaryReporter sounds like a good name vitest-dev/vitest#7881

@acelaya
Copy link
Contributor Author

acelaya commented Apr 24, 2025

Can you add a comment with an example of the output using the DefaultReporter versus this new reporter for a repository where we've enabled Vitest?

A comment where?

@acelaya acelaya force-pushed the feature/vitest-reporter branch from c955e22 to a0fcdc9 Compare April 25, 2025 08:24
@acelaya acelaya merged commit b8f7062 into main Apr 25, 2025
2 checks passed
@acelaya acelaya deleted the feature/vitest-reporter branch April 25, 2025 08:25
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

Successfully merging this pull request may close these issues.

2 participants