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.
Parameters
Section titled “Parameters”predicate
Section titled “predicate”A function that returns a boolean or a Promise that resolves to a boolean.
options?
Section titled “options?”Options for configuring the wait behavior.
Returns
Section titled “Returns”Promise<void>