MwaitFor
Bun

method

test.TestContext.waitFor

condition: () => T,
options?: TestContextWaitForOptions
): Promise<Awaited<T>>;

This method polls a condition function until that function either returns successfully or the operation times out.

@param condition

An assertion function that is invoked periodically until it completes successfully or the defined polling timeout elapses. Successful completion is defined as not throwing or rejecting. This function does not accept any arguments, and is allowed to return any value.

@param options

An optional configuration object for the polling operation.

@returns

Fulfilled with the value returned by condition.