···720720721721 When timers are run out, you may call this method to return mocked timers to its original implementations. All timers that were run before will not be restored.
722722723723-### vi.waitFor
723723+## vi.waitFor
724724725725-- **Type:** `function waitFor<T>(callback: WaitForCallback<T>, options?: number | WaitForOptions): Promise<T>`
725725+- **Type:** `<T>(callback: WaitForCallback<T>, options?: number | WaitForOptions) => Promise<T>`
726726- **Version**: Since Vitest 0.34.5
727727728728Wait for the callback to execute successfully. If the callback throws an error or returns a rejected promise it will continue to wait until it succeeds or times out.
···779779780780If `vi.useFakeTimers` is used, `vi.waitFor` automatically calls `vi.advanceTimersByTime(interval)` in every check callback.
781781782782-### vi.waitUntil
782782+## vi.waitUntil
783783784784-- **Type:** `function waitUntil(callback: WaitUntilCallback, options?: number | WaitUntilOptions): Promise`
784784+- **Type:** `<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions) => Promise<T>`
785785- **Version**: Since Vitest 0.34.5
786786787787This is similar to `vi.waitFor`, but if the callback throws any errors, execution is immediately interrupted and an error message is received. If the callback returns falsy value, the next check will continue until truthy value is returned. This is useful when you need to wait for something to exist before taking the next step.