summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2024-04-29 15:06:53 +0530
committerGitHub <noreply@github.com>2024-04-29 09:36:53 +0000
commitb8444066ea83433c8a3597407a9fb6b9e9e36085 (patch)
treec1a7686c5f776447c138e7943678060eb722626b /tests/specs
parent455cf1743f70cb12025e36b3c4eb9a213fe77199 (diff)
fix(ext/node): support NODE_DEBUG env (#23583)
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/node/node_debug/__test__.jsonc6
-rw-r--r--tests/specs/node/node_debug/hello.txt1
-rw-r--r--tests/specs/node/node_debug/main.mjs14
-rw-r--r--tests/specs/node/node_debug/main.out36
4 files changed, 57 insertions, 0 deletions
diff --git a/tests/specs/node/node_debug/__test__.jsonc b/tests/specs/node/node_debug/__test__.jsonc
new file mode 100644
index 000000000..825d3bd3f
--- /dev/null
+++ b/tests/specs/node/node_debug/__test__.jsonc
@@ -0,0 +1,6 @@
+{
+ "args": "run --allow-read main.mjs",
+ "envs": { "NODE_DEBUG": "*" },
+ "output": "main.out",
+ "exitCode": 0
+}
diff --git a/tests/specs/node/node_debug/hello.txt b/tests/specs/node/node_debug/hello.txt
new file mode 100644
index 000000000..3b18e512d
--- /dev/null
+++ b/tests/specs/node/node_debug/hello.txt
@@ -0,0 +1 @@
+hello world
diff --git a/tests/specs/node/node_debug/main.mjs b/tests/specs/node/node_debug/main.mjs
new file mode 100644
index 000000000..b33657982
--- /dev/null
+++ b/tests/specs/node/node_debug/main.mjs
@@ -0,0 +1,14 @@
+import { createReadStream } from "node:fs";
+import path from "node:path";
+
+const filePath = path.join(import.meta.dirname, "hello.txt");
+const readableStream = createReadStream(filePath);
+readableStream.on("data", (chunk) => {
+ console.log(chunk.toString());
+});
+readableStream.on("end", () => {
+ console.log("Finished reading the file");
+});
+readableStream.on("error", (error) => {
+ console.error("Error reading the file:", error);
+});
diff --git a/tests/specs/node/node_debug/main.out b/tests/specs/node/node_debug/main.out
new file mode 100644
index 000000000..efdd4c209
--- /dev/null
+++ b/tests/specs/node/node_debug/main.out
@@ -0,0 +1,36 @@
+STREAM [WILDCARD] 'resume'
+STREAM [WILDCARD] 'resume' false
+STREAM [WILDCARD] 'read' 0
+STREAM [WILDCARD] 'need readable' false
+STREAM [WILDCARD] 'length less than watermark' true
+STREAM [WILDCARD] 'reading, ended or constructing' false
+STREAM [WILDCARD] 'flow' true
+STREAM [WILDCARD] 'read' undefined
+STREAM [WILDCARD] 'need readable' true
+STREAM [WILDCARD] 'length less than watermark' true
+STREAM [WILDCARD] 'reading, ended or constructing' false
+STREAM [WILDCARD] 'read' 0
+STREAM [WILDCARD] 'need readable' true
+STREAM [WILDCARD] 'length less than watermark' true
+STREAM [WILDCARD] 'reading, ended or constructing' false
+STREAM [WILDCARD] 'maybeReadMore read 0'
+STREAM [WILDCARD] 'read' 0
+STREAM [WILDCARD] 'need readable' true
+STREAM [WILDCARD] 'length less than watermark' true
+STREAM [WILDCARD] 'do read'
+STREAM [WILDCARD] 'readableAddChunk' <Buffer 68 65 6c 6c 6f 20 77 6f 72 6c 64 0a>
+hello world
+
+STREAM [WILDCARD] 'maybeReadMore read 0'
+STREAM [WILDCARD] 'read' 0
+STREAM [WILDCARD] 'need readable' true
+STREAM [WILDCARD] 'length less than watermark' true
+STREAM [WILDCARD] 'do read'
+STREAM [WILDCARD] 'readableAddChunk' null
+STREAM [WILDCARD] 'onEofChunk'
+STREAM [WILDCARD] 'emitReadable_' false 0 true
+STREAM [WILDCARD] 'flow' true
+STREAM [WILDCARD] 'read' undefined
+STREAM [WILDCARD] 'endReadable' false
+STREAM [WILDCARD] 'endReadableNT' false 0
+Finished reading the file