diff options
Diffstat (limited to 'cli/tests')
6 files changed, 39 insertions, 0 deletions
diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs index 6f77cda84..db5330545 100644 --- a/cli/tests/integration/npm_tests.rs +++ b/cli/tests/integration/npm_tests.rs @@ -104,6 +104,13 @@ itest!(dual_cjs_esm { http_server: true, }); +itest!(child_process_fork_test { + args: "run --unstable -A --quiet npm/child_process_fork_test/main.ts", + output: "npm/child_process_fork_test/main.out", + envs: env_vars(), + http_server: true, +}); + // FIXME(bartlomieju): npm: specifiers are not handled in dynamic imports // at the moment // itest!(dynamic_import { diff --git a/cli/tests/testdata/npm/child_process_fork_test/main.out b/cli/tests/testdata/npm/child_process_fork_test/main.out new file mode 100644 index 000000000..d5bc57741 --- /dev/null +++ b/cli/tests/testdata/npm/child_process_fork_test/main.out @@ -0,0 +1,2 @@ +function +Done. diff --git a/cli/tests/testdata/npm/child_process_fork_test/main.ts b/cli/tests/testdata/npm/child_process_fork_test/main.ts new file mode 100644 index 000000000..e560edb7e --- /dev/null +++ b/cli/tests/testdata/npm/child_process_fork_test/main.ts @@ -0,0 +1,4 @@ +import "npm:chalk@4"; +import { run } from "npm:@denotest/child-process-fork"; + +run(); diff --git a/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/forked_path.js b/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/forked_path.js new file mode 100644 index 000000000..aaa106315 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/forked_path.js @@ -0,0 +1,3 @@ +const chalk = require("chalk"); + +console.log(typeof chalk.green); diff --git a/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/index.js new file mode 100644 index 000000000..674268e6f --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/index.js @@ -0,0 +1,19 @@ +const path = require("path"); + +function childProcessFork(path) { + const p = Deno.run({ + cmd: [Deno.execPath(), "run", "--unstable", "-A", path], + env: { + "DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE": Deno.core.ops.op_npm_process_state(), + } + }); + p.status().then(() => { + console.log("Done."); + }); +} + +module.exports = { + run() { + childProcessFork(path.join(__dirname, "forked_path.js")); + } +}; diff --git a/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/package.json new file mode 100644 index 000000000..9ab14e3f7 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/child-process-fork/1.0.0/package.json @@ -0,0 +1,4 @@ +{ + "name": "@denotest/child-process-fork", + "version": "1.0.0" +} |