mirror of
https://github.com/denoland/deno.git
synced 2025-01-05 13:59:01 -05:00
refactor: change tests to not rely on Deno.run() (#21961)
For https://github.com/denoland/deno/pull/21939
This commit is contained in:
parent
971eb0e5e8
commit
147bfc9c56
2 changed files with 7 additions and 9 deletions
|
@ -1,13 +1,14 @@
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
function childProcessFork(path) {
|
function childProcessFork(path) {
|
||||||
const p = Deno.run({
|
const command = new Deno.Command(Deno.execPath(), {
|
||||||
cmd: [Deno.execPath(), "run", "--unstable", "-A", path],
|
args: ["run", "--unstable", "-A", path],
|
||||||
env: {
|
env: {
|
||||||
"DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE": Deno[Deno.internal].core.ops.op_npm_process_state(),
|
"DENO_DONT_USE_INTERNAL_NODE_COMPAT_STATE": Deno[Deno.internal].core.ops.op_npm_process_state(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
p.status().then(() => {
|
const child = command.spawn();
|
||||||
|
child.status.then(() => {
|
||||||
console.log("Done.");
|
console.log("Done.");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
9
cli/tests/testdata/test/captured_output.ts
vendored
9
cli/tests/testdata/test/captured_output.ts
vendored
|
@ -1,10 +1,7 @@
|
||||||
Deno.test("output", async () => {
|
Deno.test("output", async () => {
|
||||||
// deno-lint-ignore no-deprecated-deno-api
|
await new Deno.Command(Deno.execPath(), {
|
||||||
const p = Deno.run({
|
args: ["eval", "console.log(0); console.error(1);"],
|
||||||
cmd: [Deno.execPath(), "eval", "console.log(0); console.error(1);"],
|
}).spawn().status;
|
||||||
});
|
|
||||||
await p.status();
|
|
||||||
await p.close();
|
|
||||||
new Deno.Command(Deno.execPath(), {
|
new Deno.Command(Deno.execPath(), {
|
||||||
args: ["eval", "console.log(2); console.error(3);"],
|
args: ["eval", "console.log(2); console.error(3);"],
|
||||||
stdout: "inherit",
|
stdout: "inherit",
|
||||||
|
|
Loading…
Reference in a new issue