diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-09-13 21:01:30 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-13 15:01:30 +0200 |
commit | 755cfa98ebf4e3bd96e432d6a0b761aeb2e3c818 (patch) | |
tree | 9944a58ab164b9cfac2331563986978b3591b39e /cli/tests | |
parent | b216d48e5f179260fea247d4a1b9fce76f240e7d (diff) |
feat(unstable): deno test --coverage (#6901)
This commit adds basic support for collecting coverage
data using "deno test".
Currently the report is only a text added to the end
of output from "deno test".
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration_tests.rs | 6 | ||||
-rw-r--r-- | cli/tests/test_coverage.out | 10 | ||||
-rw-r--r-- | cli/tests/test_coverage.ts | 5 |
3 files changed, 21 insertions, 0 deletions
diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index 402268dd1..b58469640 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -2348,6 +2348,12 @@ itest!(proto_exploit { output: "proto_exploit.js.out", }); +itest!(deno_test_coverage { + args: "test --coverage --unstable test_coverage.ts", + output: "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 new file mode 100644 index 000000000..85e229881 --- /dev/null +++ b/cli/tests/test_coverage.out @@ -0,0 +1,10 @@ +[WILDCARD] +running 1 tests +test returnsHiSuccess ... ok ([WILDCARD]) + +test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD]) + +test coverage: +file://[WILDCARD]/cli/tests/subdir/mod1.ts 57.143% +file://[WILDCARD]/cli/tests/subdir/subdir2/mod2.ts 50.000% +file://[WILDCARD]/cli/tests/subdir/print_hello.ts 50.000% diff --git a/cli/tests/test_coverage.ts b/cli/tests/test_coverage.ts new file mode 100644 index 000000000..72844422f --- /dev/null +++ b/cli/tests/test_coverage.ts @@ -0,0 +1,5 @@ +import { returnsHi } from "./subdir/mod1.ts"; + +Deno.test("returnsHiSuccess", function () { + returnsHi(); +}); |