PromiseTestUtils
Test helpers for awaiting promises with a bounded timeout, so a hung promise fails the test
instead of freezing the runner. Awaiting races the promise against a timeout rather than polling
with task.wait().
Functions
awaitSettled
PromiseTestUtils.awaitSettled(timeout: number?--
Defaults to 5 seconds
) → boolean--
true if the promise settled, false if it timed out
Yields until the promise settles (resolves or rejects) or the timeout elapses. Races the promise against a timeout instead of polling.
awaitValue
PromiseTestUtils.awaitValue(predicate: () → boolean,timeout: number?--
Defaults to 5 seconds
) → boolean--
The final predicate result
Yields until the predicate returns a truthy value or the timeout elapses. Used when the awaited condition is observable state rather than a promise.
awaitOutcome
PromiseTestUtils.awaitOutcome(timeout: number?--
Defaults to 5 seconds
) → ("resolved" | "rejected" | "pending",any--
The resolved value or rejection error
)Attaches resolve/reject handlers synchronously (so the rejection is always handled and never surfaces as an uncaught error) and yields for the outcome.