Skip to content

Glossary: JavaScript Beyond the Basics

Fake timers

Also written: vi.useFakeTimers, vi.setSystemTime, vi.advanceTimersByTime

A Vitest feature that replaces the real clock and timers so tests get predictable results. You set "now" with `vi.setSystemTime` and can skip ahead with `vi.advanceTimersByTime`.

Where the book teaches it

Related terms

VitestMock function