Closed nikoschon closed 3 years ago
This depends if you app()
function returns a promise or not
forgot to mention this. This is an express app instance const app = express();
Then it won't work.
You can take a look into supertest
- it is more suitable to test the whole app.
Looks like the same issue with testing a express.Router
. If a route is async, then the router will not wait for the promise to resolve and return early, but not return a promise itself so there's nothing for the test to await on.
supertest works great!
Stale issue message
The route is hit after the end of test.