-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Basic reporter but with real time progress #7881
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
Comments
I'm not really sure I understand what this issue is about. Could you show what's the output that you are seeing, and what you would like to see instead? |
I added a couple screen recordings above. The first one is what we would like to see, which is what we get by using our custom reporter. The second one is what we get with They are the same once the tests have finished, but during the execution, the default reporter displays the tests that are being executed in real time, giving a sense of progress. The basic reporter, on the other hand, does not print anything until all tests have been executed, so it feels like it's stuck until it finishes. |
The What's the difference in output when you compare default reporter and your custom one? |
This is what we see with default-reporter-no-options-2025-04-24_15.27.41.mp4And this is what we see with default-reporter-summary-false-2025-04-24_15.29.31.mp4In both cases we get a big blob of console output printed at the very end, because we pre-bundle our tests in a single file. That's the part we are trying to "hide". On top of that, with What we want is only the part that looks like this (is that the "summary"? I'm not sure):
But updated in real time, not just printed at the end. |
Do you see expected output when you have 2 test files? For example by adding import { test } from "vitest";
test("empty", () => {}); And when you have only 1 test file, do you see expected output with this kind of custom reporter: import { DefaultReporter } from "vitest/reporters";
export default class CustomReporter extends DefaultReporter {
onPathsCollected(paths) {
super.onPathsCollected(paths);
this.renderSucceed = false;
}
} I think this all might be related to weird logic of vitest/packages/vitest/src/node/reporters/default.ts Lines 71 to 81 in 8b2b61f
vitest/test/reporters/tests/default.test.ts Lines 59 to 64 in 8b2b61f
|
Oh! So you mean there could be something here not working as expected? I opened this issue assuming everything was working as intended and therefore this would be a new feature request 😅 Let me try to add a dummy test file and see. |
Ok, with two test files the output of |
Yep! This is the output we want 😄 another-custom-reporter-2025-04-24_16.02.08.mp4 |
Ok, this makes sense now. This is not exactly a bug as it works exactly as intended, but I have no idea why it was built like this in the first place. I'll check this with rest of the team. In my opinnion the As work-around for now, you can either:
|
Thanks! I think for now we'll stick with our custom reporter which does not rely on any private API, only one public method. |
It does not act as a |
As an additional note, at the time of implementing this feature, we didn't have a dynamic summary, so it might not be as relevant anymore, but jest does behave in the same way as Vitest does now. |
Clear and concise description of the problem
We have been lately trying to get vitest to report the progress of tests in real time, as it does with its default reporter, but skipping the summary of every test file.
Using
reporters: ['basic']
does something in those lines, but you don't get any sense of progress until the summary is dumped all at once at the end.As a workaround, we have defined our own test reporter which extends from
DefaultReporter
, but overridesonTestModuleEnd
as a no-op:This produces the type of output we are looking for:
desired-output-2025-04-24_11.12.01.mp4
Versus the output when using
reporters: ['basic']
:default-output-2025-04-24_11.17.35.mp4
Suggested solution
Perhaps adding a
progress?: boolean
option to the basic reporter that ensures there's some sense of progress, would be a good approach.reporters: [['basic', { progress: true }]
Alternative
I described above we are currently working around this using our custom reporter. It's pretty simple, but I thought others might want something similar.
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: