function waitFor
waitFor<T>(
fn: () =>
T
| null
| undefined
| false
| Promise<T | null | undefined | false>,
): Promise<T>

Polls until fn returns a truthy value, preserving the last thrown error on timeout.

Type Parameters

Parameters

fn: () =>
T
| null
| undefined
| false
| Promise<T | null | undefined | false>
optional
opts: WaitForOptions

Return Type

Promise<T>

Usage

import { waitFor } from "trellis-test/index.ts";