diff options
author | 2022-11-27 07:29:46 -0800 | |
---|---|---|
committer | 2022-11-27 07:29:46 -0800 | |
commit | 6459288c85b9966cb16f9505b0a6c95de6fb60cf (patch) | |
tree | f8c772c2df3e5ed3f383ade3bfc2ac514dfa6caa | |
parent | 4726b7e22732dfd1b6456aaa736d0bb959a55f8e (diff) | |
download | bun-6459288c85b9966cb16f9505b0a6c95de6fb60cf.tar.gz bun-6459288c85b9966cb16f9505b0a6c95de6fb60cf.tar.zst bun-6459288c85b9966cb16f9505b0a6c95de6fb60cf.zip |
fix hanging test
-rw-r--r-- | test/bun.js/arraybuffersink.test.ts | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/test/bun.js/arraybuffersink.test.ts b/test/bun.js/arraybuffersink.test.ts index a0c25ceb9..d747ffc64 100644 --- a/test/bun.js/arraybuffersink.test.ts +++ b/test/bun.js/arraybuffersink.test.ts @@ -1,5 +1,6 @@ import { ArrayBufferSink } from "bun"; import { describe, expect, it } from "bun:test"; +import { withoutAggressiveGC } from "gc"; describe("ArrayBufferSink", () => { const fixtures = [ @@ -69,16 +70,20 @@ describe("ArrayBufferSink", () => { for (const [input, expected, label] of fixtures) { it(`${JSON.stringify(label)}`, () => { const sink = new ArrayBufferSink(); - for (let i = 0; i < input.length; i++) { - const el = input[i]; - if (typeof el !== "number") { - sink.write(el); + withoutAggressiveGC(() => { + for (let i = 0; i < input.length; i++) { + const el = input[i]; + if (typeof el !== "number") { + sink.write(el); + } } - } + }); const output = new Uint8Array(sink.end()); - for (let i = 0; i < expected.length; i++) { - expect(output[i]).toBe(expected[i]); - } + withoutAggressiveGC(() => { + for (let i = 0; i < expected.length; i++) { + expect(output[i]).toBe(expected[i]); + } + }); expect(output.byteLength).toBe(expected.byteLength); }); } |