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

Tasks (tests, suites, hooks) that are too fast show a duration of 0ms in Task results #6377

Closed
4 tasks done
JessicaSachs opened this issue Aug 21, 2024 · 1 comment · Fixed by #6382
Closed
4 tasks done
Assignees
Labels
p3-significant High priority enhancement (priority)

Comments

@JessicaSachs
Copy link
Contributor

Clear and concise description of the problem

I was writing a custom reporter and noticed that many of the tasks I was working with were showing 0ms as their duration. Upon further digging, I noticed that Vitest uses Date.now for a lot of measurements related to timing.

I asked @sheremet-va why that is, and he mentioned that global.performance required an import from node:performance at the time of writing. Importing from node:performance would've broken browser mode for Vitest, so the team elected to use the more compatible (but less precise) Date.now to take measurements.

Suggested solution

Now that global.performance is available in all node versions that Vitest supports, we can go through everything to do with timings and swap from using Date.now to using global.performance

Alternative

We could decide not to do this.

Additional context

No response

Validations

@LuciNyan
Copy link
Contributor

I'd be happy to take on this issue. Could you assign it to me? 👀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
p3-significant High priority enhancement (priority)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants