aboutsummaryrefslogtreecommitdiff
path: root/test/bun.js/arraybuffersink.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/bun.js/arraybuffersink.test.ts')
-rw-r--r--test/bun.js/arraybuffersink.test.ts21
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);
});
}