EventBridge - ServerlessSpy


EventBridge integration has two types of methods:

  • waitForEventBridgeXxx() - Intercept all events received by EventBridge.
  • waitForEventBridgeRuleXxxYyy - Intercept only events received by Rule.

Basic example:

await serverlessSpyListener.waitForEventBridgeMyEventBus<TestData>();

await serverlessSpyListener.waitForEventBridgeRuleMyEventBusMyRule<TestData>();

You can use conditions to wait for a particular event. You can also use generic (TestData) to strongly type the event.

await serverlessSpyListener.waitForEventBridgeMyEventBus<TestData>({
  condition: (d) => === id,

await serverlessSpyListener.waitForEventBridgeRuleMyEventBusMyRule<TestData>({
  condition: (d) => === id,

Check this and this test.