#529·supertest

Error middleware not properly invoked when using async functions

Author: NinnOgTonicCreated Dec 11, 2018Updated Jan 23, 2025

When using supertest to test an express app together with the example in the readme from https://github.com/davidbanham/express-async-errors, it seems supertest will not properly invoke the error handling middleware, and thus the test just times out rather than actually responding with the logic defined in the error handler.

This behaviour works when invoking the code via HTTP.