From f5c1ff08e6c67c38043b4c76b5472ad71c93d697 Mon Sep 17 00:00:00 2001 From: Marvin Hagemeister Date: Fri, 2 Jun 2023 17:46:50 +0200 Subject: fix(node): map stdio [0, 1, 2] to "inherit" (#19352) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 🎉 --- cli/tests/unit_node/testdata/child_process_stdio_012.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 cli/tests/unit_node/testdata/child_process_stdio_012.js (limited to 'cli/tests/unit_node/testdata/child_process_stdio_012.js') 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")); -- cgit v1.2.3