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

feat: add perfStats to json reporter #933

Merged
merged 6 commits into from
Mar 13, 2022
Merged

Conversation

zxch3n
Copy link
Member

@zxch3n zxch3n commented Mar 13, 2022

Add the missing field perfStats to JSON TestResult compared to Jest test result type.

{  
  ...
  perfStats: {
    end?: Milliseconds
    runtime?: Milliseconds
    start?: Milliseconds
  },
  ...
}

@netlify
Copy link

netlify bot commented Mar 13, 2022

✔️ Deploy Preview for vitest-dev ready!

🔨 Explore the source changes: 7a45ae5

🔍 Inspect the deploy log: https://app.netlify.com/sites/vitest-dev/deploys/622db5797c19900008e19fa3

😎 Browse the preview: https://deploy-preview-933--vitest-dev.netlify.app

@sheremet-va
Copy link
Member

What about slow? Also can we make a snapshot of JSON instead of a string here? 👀

@zxch3n
Copy link
Member Author

zxch3n commented Mar 13, 2022

slow would require additional project config, like jest's slowTestThreshold [number].

Copy link
Member

@sheremet-va sheremet-va left a comment

Choose a reason for hiding this comment

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

LGTM

@antfu antfu merged commit 89c8421 into vitest-dev:main Mar 13, 2022
@JessicaSachs
Copy link
Contributor

Any reason we're not using performance.now()? My test fixtures are too fast and Date.now() is giving me "0" in the duration of my tasks.

@zxch3n
Copy link
Member Author

zxch3n commented Aug 20, 2024

@JessicaSachs duration is recorded somewhere else, which is not related to this PR

@JessicaSachs
Copy link
Contributor

That's fine, I meant in general. @sheremet-va and I spoke on Discord and he asked me to make an issue to swap the recording of stats throughout Vitest from Date.now => performance.now, citing incompatibility with previous Node versions. Vitest couldn't import from node:performance at the time, as that would've broken browser support. #6377 for future discussion.

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.

5 participants