From ae8874b4b2015453e53965dae2a2dae9cacbce70 Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Wed, 24 Feb 2021 22:27:51 +0800 Subject: feat: add "deno coverage" subcommand (#8664) This commit adds a new subcommand called "coverage" which can generate code coverage reports to stdout in multiple formats from code coverage profiles collected to disk. Currently this supports outputting a pretty printed diff and the lcov format for interoperability with third-party services and tools. Code coverage is still collected via other subcommands that run and collect code coverage such as "deno test --coverage=" but that command no longer prints a pretty printed report at the end of a test run with coverage collection enabled. The restrictions on which files that can be reported on has also been relaxed and are fully controllable with the include and exclude regular expression flags on the coverage subcommand. Co-authored-by: Luca Casonato --- cli/tests/coverage/branch.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 cli/tests/coverage/branch.ts (limited to 'cli/tests/coverage/branch.ts') diff --git a/cli/tests/coverage/branch.ts b/cli/tests/coverage/branch.ts new file mode 100644 index 000000000..352167109 --- /dev/null +++ b/cli/tests/coverage/branch.ts @@ -0,0 +1,15 @@ +export function branch(condition: boolean): boolean { + if (condition) { + return true; + } else { + return false; + } +} + +export function unused(condition: boolean): boolean { + if (condition) { + return false; + } else { + return true; + } +} -- cgit v1.2.3