summaryrefslogtreecommitdiff
path: root/cli/tests/unit_node/testdata/child_process_stdio_012.js
diff options
context:
space:
mode:
authorMarvin Hagemeister <hello@marvinh.dev>2023-06-02 17:46:50 +0200
committerGitHub <noreply@github.com>2023-06-02 09:46:50 -0600
commitf5c1ff08e6c67c38043b4c76b5472ad71c93d697 (patch)
tree5cce535783e820fdec68c5672362539b62bba473 /cli/tests/unit_node/testdata/child_process_stdio_012.js
parent25fdc7bf6c72967cec2bfbd3f18246d1515fce57 (diff)
fix(node): map stdio [0, 1, 2] to "inherit" (#19352)
<!-- Before submitting a PR, please read https://deno.com/manual/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. --> Internally, `node-tap` spawns a child process with `stdio: [0, 1, 2]`. Whilst we don't support passing fd numbers as an argument so far, it turns out that `[0, 1, 2]` is equivalent to `"inherit"` which we already support. See: https://nodejs.org/api/child_process.html#optionsstdio Mapping it to `"inherit"` is fine for us and gets us one step closer in getting `node-tap` working. I'm now at the stage where already the coverage table is shown 🎉
Diffstat (limited to 'cli/tests/unit_node/testdata/child_process_stdio_012.js')
-rw-r--r--cli/tests/unit_node/testdata/child_process_stdio_012.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/unit_node/testdata/child_process_stdio_012.js b/cli/tests/unit_node/testdata/child_process_stdio_012.js
new file mode 100644
index 000000000..682d8a084
--- /dev/null
+++ b/cli/tests/unit_node/testdata/child_process_stdio_012.js
@@ -0,0 +1,15 @@
+import childProcess from "node:child_process";
+import process from "node:process";
+import * as path from "node:path";
+
+const script = path.join(
+ path.dirname(path.fromFileUrl(import.meta.url)),
+ "node_modules",
+ "foo",
+ "index.js",
+);
+
+const child = childProcess.spawn(process.execPath, [script], {
+ stdio: [0, 1, 2],
+});
+child.on("close", () => console.log("close"));