Ensuring Clean Exit in Event Queue Program Integration Test

So I've got an integration (or maybe rather e2e) test for a program which does some work based on an event queue. The program is what I'd pass to runMain: I'm not injecting an fake services etc (for external API's I'm running fake servers, but internally the program is exactly what would run in prod). Currently it looks like this:

const programFiber = yield* _(Effect.fork(program))
yield* Effect.sleep(100)

yield* enqueueEvents
yield* Effect.sleep(100)

yield* verifySideEffect

const exit = yield* Fiber.interrupt(programFiber)

if (!Exit.isInterrupted(exit)) {
  expect(exit).toBe({})
}


My question: is there a better way to check that the program exited cleanly after being interrupted. I'd like to make sure there were no unexpected errors and if there were, have an assert fail with a useful message (including the full error).

Thanks!
Was this page helpful?