setSystemTime
function.
The
setSystemTime
function is commonly used on conjunction with Lifecycle Hooks to configure a testing environment with a deterministic “fake clock”.
To reset the system clock to the actual time, call
setSystemTime
with no arguments.
See Docs > Test Runner > Date and time for complete documentation on mocking with the Bun test runner.