forwardemail / forwardemail/supertest
[fix] .timeout(x) doesn't wait before aborting the request on node.js 26.3.0 on linux
- Dominant language
- JavaScript
- Stars
- 14.4k
- Forks
- 782
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the bug
**Node.js version:** 26.3.0 (It worked on 26.2.0 and older)
**OS version:** ubuntu-latest on github actions, also the latest [code-server docker image](https://docs.linuxserver.io/images/docker-code-server/) (also ubuntu) on Unraid 7.2.6 (Linux kernel 6.12.87)
Github actions has it passing on macOS. It skipped windows because linux failed before windows finished, and I don't have a windows machine handy right now to test it myself :/
**Description:** I'm [seeing a consistent failure](https://github.com/express-rate-limit/express-rate-limit/actions/runs/26865003421/job/79581145692?pr=638) in my [test that uses an express endpoint that drops the request and relies on supertest's `.timeout(x)` method to end the request](https://github.com/express-rate-limit/express-rate-limit/blob/19e361d7bde6300994602190b8f87c7a54ea96e3/test/library/middleware-test.ts#L709-L742).
On earlier node.js versions, calling `request(app).get('/whatever').timeout(n)` would send the request and only throw/reject if `n` milliseconds passed. Starting with node.js 26.3.0 on linux, the timeout now triggers immediately, and the request is never sent, which causes my test to fail.
It's possible that this is a node.js bug, but since I'm only seeing it with supertest, I figured I'd report it here first.
## Actual behavior
`.timeout(n)` aborts the request immediately without even calling the server endpoint. (On node 26.3.0 on linux)
## Expected behavior
`.timeout(n)` waits n milliseconds for the request to complete, and only aborts if it doesn't complete within that time frame.
## Code to reproduce
```sh
git clone https://github.com/express-rate-limit/express-rate-limit.git
cd express-rate-limit
npx pnpm install
npx jest test/library/middleware-test.ts -t "response closes"
```
## Checklist
- [x] I have searched through GitHub issues for similar issues.
- [ ] I have completely read through the README and documentation.
- [x] I have tested my code with the latest version of Node.js and this package and confirmed it is still not working.
Contributor guide
Research direction
Run the provided reproduction command against Node.js 26.3.0 on Linux, starting with test/library/middleware-test.ts and its "response closes" test. Trace the .timeout(n) request path and compare it with the behavior on Node.js 26.2.0. Done means the request reaches the endpoint and only aborts after n milliseconds, with the reproduction test passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend-api-design, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 65/100