core3-utils

@wixc3/testing on Github

Home > @wixc3/testing > withTimeout

withTimeout() function

Limits the time a promise can take

Signature:

export declare function withTimeout<T>(action: Promise<T>): PromiseWithTimeout<T>;

Parameters

Parameter Type Description
action Promise<T> a promise that should be settled before the timeout

Returns:

PromiseWithTimeout<T>

Example

await withTimeout(sleep(1000)).description('will time out').timeout(10)

timeout: 5000