/** Options supported by {@link waitFor} and {@link waitUntil}. */ interface WaitOptions { /** The maximum time to wait for the resolver to be fulfilled. Default is 150ms. */ timeout?: number; /** The interval in milliseconds to check the resolver. Default is 5ms. */ interval?: number; /** The maximum number of checks to perform. */ maxChecks?: number; } /** * Waits for a resolver to return a value. * Continues checking until `resolver` does _not_ throw an error. * * @param resolver The condition/resolver to be fulfilled. * The resolver needs to throw an error to communicate that the value is not yet ready. * * @returns A promise that transports the value of the resolver. * * @throws An error if the condition is not fulfilled within the specified timeout. * * @example * ```ts * import { waitFor } from "test-utils/waitFor"; * * const result = await waitFor(() => { * const value = getValue(); * if (value === undefined) { * throw new Error("Value not ready"); * } * return value; * }); * assert.equal(result, "myValue"); * ``` */ declare function waitFor(resolver: () => Promise | T, options?: WaitOptions): Promise; type Falsy = false | 0 | null | undefined; type NonFalsy = Exclude; /** * This function is similar to like {@link waitFor} but it will wait until the `resolver` returns a truthy value. * If the `resolver` throws an error, the function rejects immediately. * * @see waitFor */ declare function waitUntil(resolver: () => Promise | T, options?: WaitOptions): Promise>; /** * Sleeps for a certain amount of time. * * @param timeout The time to wait in milliseconds. */ declare function sleep(timeout?: number): Promise; export { sleep, waitFor, waitUntil }; export type { WaitOptions };