aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets/streams.test.js
diff options
context:
space:
mode:
Diffstat (limited to 'integration/bunjs-only-snippets/streams.test.js')
-rw-r--r--integration/bunjs-only-snippets/streams.test.js23
1 files changed, 6 insertions, 17 deletions
diff --git a/integration/bunjs-only-snippets/streams.test.js b/integration/bunjs-only-snippets/streams.test.js
index 59da95b5a..ccbea1d09 100644
--- a/integration/bunjs-only-snippets/streams.test.js
+++ b/integration/bunjs-only-snippets/streams.test.js
@@ -1,14 +1,12 @@
-import {
- file,
- gc,
- readableStreamToArrayBuffer,
- readableStreamToArray,
-} from "bun";
-import { expect, it } from "bun:test";
+import { file, readableStreamToArrayBuffer, readableStreamToArray } from "bun";
+import { expect, it, beforeEach, afterEach } from "bun:test";
import { writeFileSync } from "node:fs";
-
+import { gc } from "./gc";
new Uint8Array();
+beforeEach(() => gc());
+afterEach(() => gc());
+
it("exists globally", () => {
expect(typeof ReadableStream).toBe("function");
expect(typeof ReadableStreamBYOBReader).toBe("function");
@@ -42,18 +40,14 @@ it("ReadableStream (direct)", async () => {
});
it("ReadableStream (bytes)", async () => {
- console.trace();
-
var stream = new ReadableStream({
start(controller) {
- console.log("there");
controller.enqueue(Buffer.from("abdefgh"));
},
pull(controller) {},
cancel() {},
type: "bytes",
});
- console.log("here");
const chunks = [];
const chunk = await stream.getReader().read();
chunks.push(chunk.value);
@@ -61,7 +55,6 @@ it("ReadableStream (bytes)", async () => {
});
it("ReadableStream (default)", async () => {
- console.trace();
var stream = new ReadableStream({
start(controller) {
controller.enqueue(Buffer.from("abdefgh"));
@@ -77,7 +70,6 @@ it("ReadableStream (default)", async () => {
});
it("readableStreamToArray", async () => {
- console.trace();
var queue = [Buffer.from("abdefgh")];
var stream = new ReadableStream({
pull(controller) {
@@ -98,7 +90,6 @@ it("readableStreamToArray", async () => {
});
it("readableStreamToArrayBuffer (bytes)", async () => {
- console.trace();
var queue = [Buffer.from("abdefgh")];
var stream = new ReadableStream({
pull(controller) {
@@ -135,7 +126,6 @@ it("readableStreamToArrayBuffer (default)", async () => {
});
it("ReadableStream for Blob", async () => {
- console.trace();
var blob = new Blob(["abdefgh", "ijklmnop"]);
expect(await blob.text()).toBe("abdefghijklmnop");
var stream;
@@ -168,7 +158,6 @@ it("ReadableStream for Blob", async () => {
});
it("ReadableStream for File", async () => {
- console.trace();
var blob = file(import.meta.dir + "/fetch.js.txt");
var stream = blob.stream(24);
const chunks = [];