docs: #33837 Clarify that clock.install must precede clock operations

This commit is contained in:
Adam Gastineau 2024-12-06 11:25:34 -08:00
parent 733f9a2926
commit b48e886674

View file

@ -34,6 +34,10 @@ The recommended approach is to use `setFixedTime` to set the time to a specific
- `Event.timeStamp` - `Event.timeStamp`
::: :::
:::warning
If you call `install` at any point in your test, the call _MUST_ occur before any other clock related calls (see note above for list). For example, you cannot call `setInterval`, followed by `install`, then `clearInterval`, as `install` overrides the native definition of the clock functions.
:::
## Test with predefined time ## Test with predefined time
Often you only need to fake `Date.now` while keeping the timers going. Often you only need to fake `Date.now` while keeping the timers going.