summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration_tests.rs6
-rw-r--r--cli/tests/run_coverage.ts3
-rw-r--r--cli/tests/test_run_run_coverage.out27
-rw-r--r--cli/tests/test_run_run_coverage.ts14
4 files changed, 50 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs
index 5696f1f5b..67cafeeca 100644
--- a/cli/tests/integration_tests.rs
+++ b/cli/tests/integration_tests.rs
@@ -3322,6 +3322,12 @@ itest!(deno_test_run_test_coverage {
exit_code: 0,
});
+itest!(deno_test_run_run_coverage {
+ args: "test --allow-all --coverage --unstable test_run_run_coverage.ts",
+ output: "test_run_run_coverage.out",
+ exit_code: 0,
+});
+
itest!(deno_lint {
args: "lint --unstable lint/file1.js lint/file2.ts lint/ignored_file.ts",
output: "lint/expected.out",
diff --git a/cli/tests/run_coverage.ts b/cli/tests/run_coverage.ts
new file mode 100644
index 000000000..098d463e8
--- /dev/null
+++ b/cli/tests/run_coverage.ts
@@ -0,0 +1,3 @@
+import { returnsFoo2 } from "./subdir/mod1.ts";
+
+returnsFoo2();
diff --git a/cli/tests/test_run_run_coverage.out b/cli/tests/test_run_run_coverage.out
new file mode 100644
index 000000000..15ea230ef
--- /dev/null
+++ b/cli/tests/test_run_run_coverage.out
@@ -0,0 +1,27 @@
+Check [WILDCARD]/$deno$test.ts
+running 1 tests
+test spawn test ... Check [WILDCARD]/run_coverage.ts
+ok ([WILDCARD])
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
+
+cover [WILDCARD]/tests/run_coverage.ts ... 100.000% (3/3)
+cover [WILDCARD]/tests/subdir/mod1.ts ... 35.714% (5/14)
+ 2 | export function returnsHi() {
+ 3 | return "Hi";
+ 4 | }
+-----|-----
+ 8 | export function printHello3() {
+ 9 | printHello2();
+ 10 | }
+ 11 | export function throwsError() {
+ 12 | throw Error("exception from mod1");
+ 13 | }
+cover [WILDCARD]/tests/subdir/print_hello.ts ... 25.000% (1/4)
+ 1 | export function printHello() {
+ 2 | console.log("Hello");
+ 3 | }
+cover [WILDCARD]/tests/subdir/subdir2/mod2.ts ... 62.500% (5/8)
+ 5 | export function printHello2() {
+ 6 | printHello();
+ 7 | }
diff --git a/cli/tests/test_run_run_coverage.ts b/cli/tests/test_run_run_coverage.ts
new file mode 100644
index 000000000..448b15e7b
--- /dev/null
+++ b/cli/tests/test_run_run_coverage.ts
@@ -0,0 +1,14 @@
+Deno.test("spawn test", async function () {
+ const process = Deno.run({
+ cmd: [
+ Deno.execPath(),
+ "run",
+ "--allow-all",
+ "--unstable",
+ "run_coverage.ts",
+ ],
+ });
+
+ await process.status();
+ process.close();
+});