Describe the bug
Mocking step.waitForEvent with the steps option exactly as prescribed in the v4 testing docs throws EventValidationError: Event not found in triggers: undefined on every execution. As far as we can tell, waitForEvent cannot currently be mocked the documented way on the latest versions of both packages. The failure is identical whether the waitForEvent option is a string event name or an EventType instance.
To Reproduce
Steps to reproduce the behavior:
- Create a function that calls
step.waitForEvent
- Test it with
InngestTestEngine, mocking the wait step via the steps option with a handler that returns an event (the shape from the testing docs)
execute() the function with its trigger event
error is an EventValidationError instead of the function completing with the mocked event
Expected behavior
The mocked handler's return value resolves the waitForEvent step (or null simulates a timeout), and the function proceeds — as documented.
Code snippets / Logs / Screenshots
Minimal repro (verified on the versions below):
import { InngestTestEngine } from "@inngest/test";
import { Inngest, eventType, staticSchema } from "inngest";
const inngest = new Inngest({ id: "repro", isDev: true });
const started = eventType("demo/started", {
schema: staticSchema<{ id: string }>(),
});
const fn = inngest.createFunction(
{ id: "wait-repro", triggers: [started] },
async ({ step }) => {
const approval = await step.waitForEvent("wait-for-approval", {
event: "demo/approved",
timeout: "1d",
});
return { approved: approval !== null };
},
);
const t = new InngestTestEngine({
function: fn,
steps: [
{
id: "wait-for-approval",
handler() {
return { name: "demo/approved", data: { ok: true } };
},
},
],
});
const { error } = await t.execute({
events: [started.create({ id: "1" })],
});
error is:
EventValidationError: Event not found in triggers: undefined
at getValidatorForEvent (inngest/components/triggers/utils.js:92)
at validateEvents (inngest/components/triggers/utils.js:75)
at inngest/components/execution/engine.js:1435
System info (please complete the following information):
- OS: macOS
- npm package Version:
inngest 4.13.0, @inngest/test 1.0.0 (both latest)
- Framework: none — repro is framework-independent (run under vitest; we use Fastify in the app)
- Platform: local test run (Node 24, TypeScript 5.9)
Additional context
Our interim workaround is a transformCtx that replaces step.waitForEvent with a stub, bypassing the engine's step machinery for that tool.
Describe the bug
Mocking
step.waitForEventwith thestepsoption exactly as prescribed in the v4 testing docs throwsEventValidationError: Event not found in triggers: undefinedon every execution. As far as we can tell,waitForEventcannot currently be mocked the documented way on the latest versions of both packages. The failure is identical whether thewaitForEventoption is a string event name or anEventTypeinstance.To Reproduce
Steps to reproduce the behavior:
step.waitForEventInngestTestEngine, mocking the wait step via thestepsoption with a handler that returns an event (the shape from the testing docs)execute()the function with its trigger eventerroris anEventValidationErrorinstead of the function completing with the mocked eventExpected behavior
The mocked handler's return value resolves the
waitForEventstep (ornullsimulates a timeout), and the function proceeds — as documented.Code snippets / Logs / Screenshots
Minimal repro (verified on the versions below):
erroris:System info (please complete the following information):
inngest4.13.0,@inngest/test1.0.0 (both latest)Additional context
Our interim workaround is a
transformCtxthat replacesstep.waitForEventwith a stub, bypassing the engine's step machinery for that tool.