From 5cf194380bcad0fd763fb0893ec49bfc91fda15d Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Thu, 28 Jan 2021 22:11:38 +0800 Subject: 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. --- cli/tests/test_coverage.out | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'cli/tests/test_coverage.out') 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 | } -- cgit v1.2.3