From 339d2c7f190c81bbf2c64f3fd5715b3ebe8841ab Mon Sep 17 00:00:00 2001 From: Ai Hoshino Date: Fri, 25 Aug 2023 08:16:51 +0800 Subject: Make the server not crash if an error occurs in dev build. (#4300) Close: #4298 --- test/js/node/http/node-http.test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/js/node/http/node-http.test.ts') diff --git a/test/js/node/http/node-http.test.ts b/test/js/node/http/node-http.test.ts index 6dca23547..3a654c393 100644 --- a/test/js/node/http/node-http.test.ts +++ b/test/js/node/http/node-http.test.ts @@ -750,4 +750,20 @@ describe("node:http", () => { } }); }); + + test("test server internal error, issue#4298", done => { + const server = createServer((req, res) => { + throw Error("throw an error here."); + }); + server.listen({ port: 0 }, async (_err, host, port) => { + try { + await fetch(`http://${host}:${port}`).then(res => { + expect(res.status).toBe(500); + done(); + }); + } catch (err) { + done(err); + } + }); + }); }); -- cgit v1.2.3