forwardemail / forwardemail/supertest

Promises makes jest test time out

Open
#697 22 comments 22 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
14.4k
Forks
782
PR merge metrics
No merged PRs in 30d

Description

Hello 👋
Thank you for maintaining this project.

I believe I am experiencing a bug where awaiting a call to get response causes timeout.

Minimal example:
```ts
it("TIMEOUT when awaiting", async () => {

await supertest(app)
.get("/users/me")
});

it("TIMEOUT when using .then", (done) => {

supertest(app)
.get("/users/me")
.then(response => {

done();
});
});

it("WORKING when not using promises at all", () => {

supertest(app)
.get("/users/me");
});
```

The two first tests are failing with the following message:
`Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Timeout - Async callback was not invoked within the 5000 ms timeout specified by jest.setTimeout.Error:`

Please let me know if I have left out any useful information.

All the best! Olav

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.