Skip to content

waitFor

waitFor(predicate, options?): Promise<void>

Defined in: packages/core/src/function/wait-for.ts:32

Waits until the provided condition function returns true.

The condition function can be synchronous or asynchronous (returning a Promise). The function checks the condition at regular intervals specified by intervalMs.

Note: This function shouldn’t be used inplace of the vi.waitFor function from Vitest. This function is meant to be used in non-test code.

MaybeAsyncPredicate

A function that returns a boolean or a Promise that resolves to a boolean.

WaitForOptions

Options for configuring the wait behavior.

Promise<void>