Tasks (tests, suites, hooks) that are too fast show a duration of 0ms in Task results #6377
Closed
4 tasks done
Labels
p3-significant
High priority enhancement (priority)
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 fromnode:performance
at the time of writing. Importing fromnode: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 usingDate.now
to usingglobal.performance
Alternative
We could decide not to do this.
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: