diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/coverage_tests.rs | 1 | ||||
-rw-r--r-- | cli/tests/testdata/coverage/complex_test.ts | 32 |
2 files changed, 33 insertions, 0 deletions
diff --git a/cli/tests/integration/coverage_tests.rs b/cli/tests/integration/coverage_tests.rs index 59c1a5092..251577c4b 100644 --- a/cli/tests/integration/coverage_tests.rs +++ b/cli/tests/integration/coverage_tests.rs @@ -32,6 +32,7 @@ fn run_coverage_text(test_name: &str, extension: &str) { let status = util::deno_cmd_with_deno_dir(&deno_dir) .current_dir(util::testdata_path()) .arg("test") + .arg("-A") .arg("--quiet") .arg("--unstable") .arg(format!("--coverage={}", tempdir.to_str().unwrap())) diff --git a/cli/tests/testdata/coverage/complex_test.ts b/cli/tests/testdata/coverage/complex_test.ts index fda948bc3..1202289cb 100644 --- a/cli/tests/testdata/coverage/complex_test.ts +++ b/cli/tests/testdata/coverage/complex_test.ts @@ -3,3 +3,35 @@ import { complex } from "./complex.ts"; Deno.test("complex", function () { complex("foo", "bar", "baz"); }); + +Deno.test("sub process with stdin", async () => { + // ensure launching deno run with stdin doesn't affect coverage + const code = "console.log('5')"; + const p = await Deno.run({ + cmd: [Deno.execPath(), "run", "-"], + stdin: "piped", + stdout: "piped", + }); + const encoder = new TextEncoder(); + await p.stdin.write(encoder.encode(code)); + await p.stdin.close(); + const output = new TextDecoder().decode(await p.output()); + p.close(); + if (output.trim() !== "5") { + throw new Error("Failed"); + } +}); + +Deno.test("sub process with deno eval", async () => { + // ensure launching deno eval doesn't affect coverage + const code = "console.log('5')"; + const p = await Deno.run({ + cmd: [Deno.execPath(), "eval", code], + stdout: "piped", + }); + const output = new TextDecoder().decode(await p.output()); + p.close(); + if (output.trim() !== "5") { + throw new Error("Failed"); + } +}); |