-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
Hi y'all!
I wanted to ask, what is the stance of the team on providing a way to set mocks on global timing-related APIs that can be locked to a given scope? For example:
import FakeTimers from "@sinonjs/fake-timers";
const timer = FakeTimers.install({ toFake: ['Date'] });
function blockA() {
return timer.useSystemTime(0, () => `Current timetstamp is ${Date.now()}`);
}
function blockB() {
return `Current timetstamp is ${Date.now()}`;
}
// Run concurrently, blockA returns timestamp of 0,
// while blockB returns actual timestampThis is related to vitest#5750
mikkopiu
Metadata
Metadata
Assignees
Labels
No labels