function assertEventCaptured
assertEventCaptured<
TEventName extends TrellisTestEventCaptureEventName<TCapture>
>
(
capture: TCapture,
eventName: TEventName,
predicate?: TrellisTestAssertionEventPredicate<TrellisTestEventCaptureEventByName<TCapture, TEventName>>,
options?: WaitForOptions
): Promise<TrellisTestEventCaptureEventByName<TCapture, TEventName>>

Waits for a captured event and fails with captured-event context when it is absent.

The helper polls capture.all() so generated multi-event captures can be passed directly, then wraps failures with a compact list of events captured so far.

Type Parameters

TEventName extends TrellisTestEventCaptureEventName<TCapture>

Parameters

capture: TCapture
eventName: TEventName
optional
predicate: TrellisTestAssertionEventPredicate<TrellisTestEventCaptureEventByName<TCapture, TEventName>>
optional
options: WaitForOptions

Return Type

Promise<TrellisTestEventCaptureEventByName<TCapture, TEventName>>

Usage

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