From 3078fcf55a8aa04d26316ab353d84f2c9512bd47 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Mon, 21 Dec 2020 21:04:25 +0800 Subject: feat(unstable): record raw coverage into a directory (#8642) --- cli/tests/integration_tests.rs | 12 ++++++++++++ cli/tests/test_coverage.out | 8 ++++---- cli/tests/test_run_test_coverage.out | 32 ++++++++++++++++++++++++++++++++ cli/tests/test_run_test_coverage.ts | 14 ++++++++++++++ 4 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 cli/tests/test_run_test_coverage.out create mode 100644 cli/tests/test_run_test_coverage.ts (limited to 'cli/tests') diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 302e808fa..5696f1f5b 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -3310,6 +3310,18 @@ itest!(deno_test_coverage { exit_code: 0, }); +itest!(deno_test_coverage_explicit { + args: "test --coverage=.test_coverage --unstable test_coverage.ts", + output: "test_coverage.out", + exit_code: 0, +}); + +itest!(deno_test_run_test_coverage { + args: "test --allow-all --coverage --unstable test_run_test_coverage.ts", + output: "test_run_test_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/test_coverage.out b/cli/tests/test_coverage.out index a4b37e4de..b8423e7fd 100644 --- a/cli/tests/test_coverage.out +++ b/cli/tests/test_coverage.out @@ -15,11 +15,11 @@ cover [WILDCARD]/cli/tests/subdir/mod1.ts ... 35.714% (5/14) 11 | export function throwsError() { 12 | throw Error("exception from mod1"); 13 | } -cover [WILDCARD]/cli/tests/subdir/subdir2/mod2.ts ... 62.500% (5/8) - 5 | export function printHello2() { - 6 | printHello(); - 7 | } cover [WILDCARD]/cli/tests/subdir/print_hello.ts ... 25.000% (1/4) 1 | export function printHello() { 2 | console.log("Hello"); 3 | } +cover [WILDCARD]/cli/tests/subdir/subdir2/mod2.ts ... 62.500% (5/8) + 5 | export function printHello2() { + 6 | printHello(); + 7 | } diff --git a/cli/tests/test_run_test_coverage.out b/cli/tests/test_run_test_coverage.out new file mode 100644 index 000000000..bcaae01a1 --- /dev/null +++ b/cli/tests/test_run_test_coverage.out @@ -0,0 +1,32 @@ +Check [WILDCARD]/$deno$test.ts +running 1 tests +test spawn test ... Check [WILDCARD]/$deno$test.ts +running 1 tests +test returnsFooSuccess ... ok ([WILDCARD]) + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +ok ([WILDCARD]) + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +cover [WILDCARD]/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]/subdir/print_hello.ts ... 25.000% (1/4) + 1 | export function printHello() { + 2 | console.log("Hello"); + 3 | } +cover [WILDCARD]/subdir/subdir2/mod2.ts ... 62.500% (5/8) + 5 | export function printHello2() { + 6 | printHello(); + 7 | } +cover [WILDCARD]/test_coverage.ts ... 100.000% (5/5) diff --git a/cli/tests/test_run_test_coverage.ts b/cli/tests/test_run_test_coverage.ts new file mode 100644 index 000000000..e3f0e47ce --- /dev/null +++ b/cli/tests/test_run_test_coverage.ts @@ -0,0 +1,14 @@ +Deno.test("spawn test", async function () { + const process = Deno.run({ + cmd: [ + Deno.execPath(), + "test", + "--allow-all", + "--unstable", + "test_coverage.ts", + ], + }); + + await process.status(); + process.close(); +}); -- cgit v1.2.3