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

fix: align json output with jest's #1034

Merged
merged 7 commits into from Mar 29, 2022
Merged

Conversation

zxch3n
Copy link
Member

@zxch3n zxch3n commented Mar 27, 2022

In the current version(v0.7.11), the JSON reporter's output format deviates from jest's. See Stackblitz example.

In PR #489 json reporter is added, it implements the subset of jest's AggregatedResult type. However, jest --json output is using FormattedTestResults.

And each object in testResults should represents a file rather than a test case.

@netlify
Copy link

netlify bot commented Mar 27, 2022

Deploy Preview for vitest-dev ready!

Name Link
🔨 Latest commit 86a1b13
🔍 Latest deploy log https://app.netlify.com/sites/vitest-dev/deploys/62401c231638e7000827a2fc
😎 Deploy Preview https://deploy-preview-1034--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@patak-dev
Copy link
Member

Thanks for the PR @zxch3n! Things like status being pass instead of passed looks quite important to correct. Interesting that no one noticed this before. I wonder if tools consuming this format are able to accept both.

@cexbrayat would you help us review this PR and check that it won't be a breaking change for your use case?

@antfu antfu added this to the Next milestone Mar 27, 2022
Copy link
Contributor

@cexbrayat cexbrayat left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @zxch3n 👍

@krzysztofradomski
Copy link

Hey all. Just like to add wanted to weight in from a hmm regular user's perspective ;)
In my current project we've recently switched from jest to vitest, very happy with the change, but the we could not consume the json output in Storybook... So I wrote a simple Storybook addon, which I published to npm just yesterday. This addon of mine depends on the current structure of the output file, and now today I've found this thread haha!

@patak-dev
Copy link
Member

Hey all. Just like to add wanted to weight in from a hmm regular user's perspective ;) In my current project we've recently switched from jest to vitest, very happy with the change, but the we could not consume the json output in Storybook... So I wrote a simple Storybook addon, which I published to npm just yesterday. This addon of mine depends on the current structure of the output file, and now today I've found this thread haha!

😬
Well, at least it should be only about removing the addon, no? Have you tried this PR? It would be good to get another confirmation that it is working as expected.

@krzysztofradomski
Copy link

krzysztofradomski commented Mar 28, 2022 via email

@antfu antfu merged commit 3326332 into vitest-dev:main Mar 29, 2022
@antfu antfu removed this from the Next milestone May 3, 2022
chaii3 pushed a commit to chaii3/vitest that referenced this pull request May 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants