refactor: remove deno.run (#1036)

Co-authored-by: Luca Casonato <hello@lcas.dev>
This commit is contained in:
Sylvain Cau
2023-03-10 04:57:16 +09:00
committed by GitHub
co-authored by Luca Casonato
parent 891503e77f
commit 7e72fa236c
6 changed files with 63 additions and 88 deletions
+8 -11
View File
@@ -500,9 +500,8 @@ Deno.test("experimental Deno.serve", {
ignore: Deno.build.os === "windows", // TODO: Deno.serve hang on Windows?
}, async (t) => {
// Preparation
const serverProcess = Deno.run({
cmd: [
"deno",
const serverProcess = new Deno.Command(Deno.execPath(), {
args: [
"run",
"-A",
"--unstable",
@@ -511,10 +510,10 @@ Deno.test("experimental Deno.serve", {
],
stdout: "piped",
stderr: "inherit",
});
}).spawn();
const decoder = new TextDecoderStream();
const lines = serverProcess.stdout.readable
const lines = serverProcess.stdout
.pipeThrough(decoder)
.pipeThrough(new TextLineStream());
@@ -562,7 +561,6 @@ Deno.test("experimental Deno.serve", {
await lines.cancel();
serverProcess.kill("SIGTERM");
serverProcess.close();
});
Deno.test("jsx pragma works", {
@@ -570,14 +568,14 @@ Deno.test("jsx pragma works", {
sanitizeResources: false,
}, async (t) => {
// Preparation
const serverProcess = Deno.run({
cmd: ["deno", "run", "-A", "./tests/fixture_jsx_pragma/main.ts"],
const serverProcess = new Deno.Command(Deno.execPath(), {
args: ["run", "-A", "./tests/fixture_jsx_pragma/main.ts"],
stdout: "piped",
stderr: "inherit",
});
}).spawn();
const decoder = new TextDecoderStream();
const lines = serverProcess.stdout.readable
const lines = serverProcess.stdout
.pipeThrough(decoder)
.pipeThrough(new TextLineStream());
@@ -617,5 +615,4 @@ Deno.test("jsx pragma works", {
await lines.cancel();
serverProcess.kill("SIGTERM");
serverProcess.close();
});