Vitest · Method
vi.waitFor
vi.waitFor retries a callback until it completes without throwing or rejecting, or until the wait times out. It returns the callback's successful result.
Last updated
Syntax
function waitFor<T>(callback: WaitForCallback<T>, options?: number | WaitForOptions): Promise<T>In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
expect.pollvi.waitUntilvi.useFakeTimersvi.waitFor