diff options
| author | Casper Beyer <caspervonb@pm.me> | 2021-01-20 22:51:36 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-20 15:51:36 +0100 |
| commit | 413f79a4941d266ca1e6b61de80f83b16f6a4a4e (patch) | |
| tree | dec9f01b7796bc3c952a446702d1ddbb841af43d /cli/tests | |
| parent | 47263ef6fafdad22546396f9e2ce1ca020c7cd3d (diff) | |
fix(coverage): ignore comments (#8639)
This commit fixes coverage collection by ignoring
comments when tallying up line counts.
Diffstat (limited to 'cli/tests')
| -rw-r--r-- | cli/tests/integration_tests.rs | 6 | ||||
| -rw-r--r-- | cli/tests/subdir/comment.ts | 4 | ||||
| -rw-r--r-- | cli/tests/test_comment_coverage.out | 7 | ||||
| -rw-r--r-- | cli/tests/test_comment_coverage.ts | 5 |
4 files changed, 22 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 80a7222e5..be7bb63c5 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -3437,6 +3437,12 @@ itest!(deno_test_coverage { exit_code: 0, }); +itest!(deno_test_comment_coverage { + args: "test --coverage --unstable test_comment_coverage.ts", + output: "test_comment_coverage.out", + exit_code: 0, +}); + itest!(deno_test_branch_coverage { args: "test --coverage --unstable test_branch_coverage.ts", output: "test_branch_coverage.out", diff --git a/cli/tests/subdir/comment.ts b/cli/tests/subdir/comment.ts new file mode 100644 index 000000000..ea7e630c0 --- /dev/null +++ b/cli/tests/subdir/comment.ts @@ -0,0 +1,4 @@ +// This is a comment. +export function comment(): string { + return "comment"; +} diff --git a/cli/tests/test_comment_coverage.out b/cli/tests/test_comment_coverage.out new file mode 100644 index 000000000..582152fa1 --- /dev/null +++ b/cli/tests/test_comment_coverage.out @@ -0,0 +1,7 @@ +[WILDCARD]/tests/$deno$test.ts +running 1 tests +test comment ... ok ([WILDCARD]) + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +[WILDCARD]/tests/subdir/comment.ts ... 100.000% (4/4) diff --git a/cli/tests/test_comment_coverage.ts b/cli/tests/test_comment_coverage.ts new file mode 100644 index 000000000..28a25c65d --- /dev/null +++ b/cli/tests/test_comment_coverage.ts @@ -0,0 +1,5 @@ +import { comment } from "./subdir/comment.ts"; + +Deno.test("comment", function () { + comment(); +}); |
