diff options
author | 2023-09-18 17:57:48 -0400 | |
---|---|---|
committer | 2023-09-18 14:57:48 -0700 | |
commit | f77df12894e7952ea58605432bf9f6d252fff273 (patch) | |
tree | 244cca925e8cff9b187c213c93ef588edf3b3b60 /test | |
parent | 8f8ab301b415ac92b28211114daae44230703b2f (diff) | |
download | bun-f77df12894e7952ea58605432bf9f6d252fff273.tar.gz bun-f77df12894e7952ea58605432bf9f6d252fff273.tar.zst bun-f77df12894e7952ea58605432bf9f6d252fff273.zip |
Fix HTTP listen behavior being non-compliant with node (#5689)
* Fix HTTP listen behavior being non-compliant with node
* Add error code for address in use
* use SystemError
---------
Co-authored-by: SuperAuguste <19855629+SuperAuguste@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/js/node/http/node-http.test.ts | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts index 24c0b40bf..326699665 100644 --- a/test/js/node/http/node-http.test.ts +++ b/test/js/node/http/node-http.test.ts @@ -926,4 +926,20 @@ describe("node:http", () => { } }); }); + + test("error event not fired, issue#4651", done => { + const server = createServer((req, res) => { + res.end(); + }); + server.listen({ port: 42069 }, () => { + const server2 = createServer((_, res) => { + res.end(); + }); + server2.on("error", err => { + expect(err.code).toBe("EADDRINUSE"); + done(); + }); + server2.listen({ port: 42069 }, () => {}); + }); + }); }); |