diff options
author | 2022-11-20 01:44:18 -0800 | |
---|---|---|
committer | 2022-11-20 01:44:18 -0800 | |
commit | 4f5f01a74876c815f21ed82663cd31b71c9594c4 (patch) | |
tree | bb44d1b297759f2f4acd8ab189c1a57ae580880c /test/bun.js | |
parent | e41d7a0bd5f81d380868b07a7621195fcadbd7af (diff) | |
download | bun-4f5f01a74876c815f21ed82663cd31b71c9594c4.tar.gz bun-4f5f01a74876c815f21ed82663cd31b71c9594c4.tar.zst bun-4f5f01a74876c815f21ed82663cd31b71c9594c4.zip |
Fix flaky test
Diffstat (limited to 'test/bun.js')
-rw-r--r-- | test/bun.js/fetch-gzip.test.ts | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/test/bun.js/fetch-gzip.test.ts b/test/bun.js/fetch-gzip.test.ts index 2cc795655..f9b277718 100644 --- a/test/bun.js/fetch-gzip.test.ts +++ b/test/bun.js/fetch-gzip.test.ts @@ -196,11 +196,14 @@ it("fetch() with a gzip response works (multiple chunks, TCP server)", async (do const compressed = await Bun.file( import.meta.dir + "/fixture.html.gz", ).arrayBuffer(); + var socketToClose; const server = Bun.listen({ port: 4024, hostname: "0.0.0.0", socket: { async open(socket) { + socketToClose = socket; + var corked: any[] = []; var cork = true; async function write(chunk) { @@ -232,7 +235,7 @@ it("fetch() with a gzip response works (multiple chunks, TCP server)", async (do await write(compressed.slice(i - 100, i)); } await write(compressed.slice(i - 100)); - await socket.end(); + socket.flush(); }, drain(socket) {}, }, @@ -248,6 +251,7 @@ it("fetch() with a gzip response works (multiple chunks, TCP server)", async (do ), ), ).toBe(true); + socketToClose.end(); server.stop(); done(); }); |