diff options
-rw-r--r-- | src/bun.js/http.exports.js | 2 | ||||
-rw-r--r-- | test/bun.js/node-http.test.ts | 9 |
2 files changed, 10 insertions, 1 deletions
diff --git a/src/bun.js/http.exports.js b/src/bun.js/http.exports.js index 00e2c2dc9..59e2d3483 100644 --- a/src/bun.js/http.exports.js +++ b/src/bun.js/http.exports.js @@ -289,6 +289,8 @@ export class Server extends EventEmitter { } this.emit("error", err); } + + return this; } } diff --git a/test/bun.js/node-http.test.ts b/test/bun.js/node-http.test.ts index e3d20f1c0..4dff93857 100644 --- a/test/bun.js/node-http.test.ts +++ b/test/bun.js/node-http.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, beforeAll, afterAll } from "bun:test"; -import { createServer, request, get, Agent, globalAgent } from "node:http"; +import { createServer, request, get, Agent, globalAgent, Server } from "node:http"; import { createDoneDotAll } from "node-test-helpers"; describe("node:http", () => { @@ -69,6 +69,13 @@ describe("node:http", () => { expect(out).toBe(input); server.close(); }); + + it("listen should return server", async () => { + const server = createServer(); + const listenResponse = server.listen(8129); + expect(listenResponse instanceof Server).toBe(true); + expect(listenResponse).toBe(server); + }); }); describe("request", () => { |