diff options
author | Casper Beyer <caspervonb@pm.me> | 2021-01-28 22:11:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-28 15:11:38 +0100 |
commit | 5cf194380bcad0fd763fb0893ec49bfc91fda15d (patch) | |
tree | 95a35e7b6485c5f0893b99ca1b9e1484e220c9d0 /cli/tests | |
parent | 591ed6b3ad786b756e66c2f64f365c76b4ccd617 (diff) |
fix(coverage): use source maps when printing pretty reports (#9278)
This commits makes use of source maps and the original source
when printing lacking line coverage in the pretty printer.
Only the executable lines are checked as before (as non-executable
lines will always be ignored anyways). The lines then mapped to the
appropriate source line when a source map is present.
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/test_branch_coverage.out | 6 | ||||
-rw-r--r-- | cli/tests/test_coverage.out | 33 | ||||
-rw-r--r-- | cli/tests/test_run_combined_coverage.out | 21 | ||||
-rw-r--r-- | cli/tests/test_run_run_coverage.out | 35 | ||||
-rw-r--r-- | cli/tests/test_run_test_coverage.out | 39 |
5 files changed, 70 insertions, 64 deletions
diff --git a/cli/tests/test_branch_coverage.out b/cli/tests/test_branch_coverage.out index 69e81f881..e52c4bac0 100644 --- a/cli/tests/test_branch_coverage.out +++ b/cli/tests/test_branch_coverage.out @@ -5,6 +5,6 @@ test branch ... ok ([WILDCARD]) test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) cover [WILDCARD]/tests/subdir/branch.ts ... 66.667% (6/9) - 5 | else { - 6 | return false; - 7 | } + 4 | } else { + 5 | return false; + 6 | } diff --git a/cli/tests/test_coverage.out b/cli/tests/test_coverage.out index b8423e7fd..709d57d3b 100644 --- a/cli/tests/test_coverage.out +++ b/cli/tests/test_coverage.out @@ -4,22 +4,23 @@ test returnsFooSuccess ... ok ([WILDCARD]) test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) -cover [WILDCARD]/cli/tests/subdir/mod1.ts ... 35.714% (5/14) - 2 | export function returnsHi() { - 3 | return "Hi"; - 4 | } +cover [WILDCARD]/tests/subdir/mod1.ts ... 35.714% (5/14) + 3 | export function returnsHi(): string { + 4 | return "Hi"; + 5 | } -----|----- - 8 | export function printHello3() { - 9 | printHello2(); - 10 | } - 11 | export function throwsError() { - 12 | throw Error("exception from mod1"); + 11 | export function printHello3(): void { + 12 | printHello2(); 13 | } -cover [WILDCARD]/cli/tests/subdir/print_hello.ts ... 25.000% (1/4) - 1 | export function printHello() { - 2 | console.log("Hello"); +-----|----- + 15 | export function throwsError(): void { + 16 | throw Error("exception from mod1"); + 17 | } +cover [WILDCARD]/tests/subdir/print_hello.ts ... 25.000% (1/4) + 1 | export function printHello(): void { + 2 | console.log("Hello"); 3 | } -cover [WILDCARD]/cli/tests/subdir/subdir2/mod2.ts ... 62.500% (5/8) - 5 | export function printHello2() { - 6 | printHello(); - 7 | } +cover [WILDCARD]/tests/subdir/subdir2/mod2.ts ... 62.500% (5/8) + 7 | export function printHello2(): void { + 8 | printHello(); + 9 | } diff --git a/cli/tests/test_run_combined_coverage.out b/cli/tests/test_run_combined_coverage.out index 476e9adcc..24ceb9955 100644 --- a/cli/tests/test_run_combined_coverage.out +++ b/cli/tests/test_run_combined_coverage.out @@ -14,18 +14,19 @@ test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WIL cover [WILDCARD]/tests/run_coverage.ts ... 100.000% (3/3) cover [WILDCARD]/tests/subdir/mod1.ts ... 57.143% (8/14) - 8 | export function printHello3() { - 9 | printHello2(); - 10 | } - 11 | export function throwsError() { - 12 | throw Error("exception from mod1"); + 11 | export function printHello3(): void { + 12 | printHello2(); 13 | } +-----|----- + 15 | export function throwsError(): void { + 16 | throw Error("exception from mod1"); + 17 | } cover [WILDCARD]/tests/subdir/print_hello.ts ... 25.000% (1/4) - 1 | export function printHello() { - 2 | console.log("Hello"); + 1 | export function printHello(): void { + 2 | console.log("Hello"); 3 | } cover [WILDCARD]/tests/subdir/subdir2/mod2.ts ... 62.500% (5/8) - 5 | export function printHello2() { - 6 | printHello(); - 7 | } + 7 | export function printHello2(): void { + 8 | printHello(); + 9 | } cover [WILDCARD]/tests/test_coverage.ts ... 100.000% (5/5) diff --git a/cli/tests/test_run_run_coverage.out b/cli/tests/test_run_run_coverage.out index 2f18020d3..97eb29264 100644 --- a/cli/tests/test_run_run_coverage.out +++ b/cli/tests/test_run_run_coverage.out @@ -7,23 +7,26 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WIL cover [WILDCARD]/tests/run_coverage.ts ... 100.000% (3/3) cover [WILDCARD]/tests/subdir/mod1.ts ... 35.714% (5/14) - 5 | export function returnsFoo2() { - 6 | return returnsFoo(); - 7 | } - 8 | export function printHello3() { - 9 | printHello2(); - 10 | } - 11 | export function throwsError() { - 12 | throw Error("exception from mod1"); + 7 | export function returnsFoo2(): string { + 8 | return returnsFoo(); + 9 | } +-----|----- + 11 | export function printHello3(): void { + 12 | printHello2(); 13 | } +-----|----- + 15 | export function throwsError(): void { + 16 | throw Error("exception from mod1"); + 17 | } cover [WILDCARD]/tests/subdir/print_hello.ts ... 25.000% (1/4) - 1 | export function printHello() { - 2 | console.log("Hello"); + 1 | export function printHello(): void { + 2 | console.log("Hello"); 3 | } cover [WILDCARD]/tests/subdir/subdir2/mod2.ts ... 25.000% (2/8) - 2 | export function returnsFoo() { - 3 | return "Foo"; - 4 | } - 5 | export function printHello2() { - 6 | printHello(); - 7 | } + 3 | export function returnsFoo(): string { + 4 | return "Foo"; + 5 | } +-----|----- + 7 | export function printHello2(): void { + 8 | printHello(); + 9 | } diff --git a/cli/tests/test_run_test_coverage.out b/cli/tests/test_run_test_coverage.out index bcaae01a1..186ecba13 100644 --- a/cli/tests/test_run_test_coverage.out +++ b/cli/tests/test_run_test_coverage.out @@ -1,6 +1,6 @@ -Check [WILDCARD]/$deno$test.ts +Check [WILDCARD]/tests/$deno$test.ts running 1 tests -test spawn test ... Check [WILDCARD]/$deno$test.ts +test spawn test ... Check [WILDCARD]/tests/$deno$test.ts running 1 tests test returnsFooSuccess ... ok ([WILDCARD]) @@ -10,23 +10,24 @@ 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 | } +cover [WILDCARD]/tests/subdir/mod1.ts ... 35.714% (5/14) + 3 | export function returnsHi(): string { + 4 | return "Hi"; + 5 | } -----|----- - 8 | export function printHello3() { - 9 | printHello2(); - 10 | } - 11 | export function throwsError() { - 12 | throw Error("exception from mod1"); + 11 | export function printHello3(): void { + 12 | printHello2(); 13 | } -cover [WILDCARD]/subdir/print_hello.ts ... 25.000% (1/4) - 1 | export function printHello() { - 2 | console.log("Hello"); +-----|----- + 15 | export function throwsError(): void { + 16 | throw Error("exception from mod1"); + 17 | } +cover [WILDCARD]/tests/subdir/print_hello.ts ... 25.000% (1/4) + 1 | export function printHello(): void { + 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) +cover [WILDCARD]/tests/subdir/subdir2/mod2.ts ... 62.500% (5/8) + 7 | export function printHello2(): void { + 8 | printHello(); + 9 | } +cover [WILDCARD]/tests/test_coverage.ts ... 100.000% (5/5) |