mirror of
https://github.com/denoland/deno.git
synced 2025-09-26 12:19:12 +00:00
feat(test): support DENO_COVERAGE_DIR env var (#28291)
This PR adds support of `DENO_COVERAGE_DIR` for controlling coverage output.
This commit is contained in:
parent
a5b407c390
commit
202f5f3910
6 changed files with 43 additions and 1 deletions
18
tests/specs/coverage/set_coverage_in_env_var/__test__.jsonc
Normal file
18
tests/specs/coverage/set_coverage_in_env_var/__test__.jsonc
Normal file
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"tempDir": true,
|
||||
"steps": [
|
||||
{
|
||||
"args": "test -A",
|
||||
"output": "test.out",
|
||||
"envs": {
|
||||
"DENO_COVERAGE_DIR": "my_coverage_dir"
|
||||
},
|
||||
"exitCode": 0
|
||||
},
|
||||
{
|
||||
"args": "coverage my_coverage_dir",
|
||||
"output": "coverage.out",
|
||||
"exitCode": 0
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
--------------------------------
|
||||
File | Branch % | Line % |
|
||||
--------------------------------
|
||||
source.ts | 100.0 | 100.0 |
|
||||
--------------------------------
|
||||
All files | 100.0 | 100.0 |
|
||||
--------------------------------
|
3
tests/specs/coverage/set_coverage_in_env_var/source.ts
Normal file
3
tests/specs/coverage/set_coverage_in_env_var/source.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
export function add(a: number, b: number): number {
|
||||
return a + b;
|
||||
}
|
7
tests/specs/coverage/set_coverage_in_env_var/test.out
Normal file
7
tests/specs/coverage/set_coverage_in_env_var/test.out
Normal file
|
@ -0,0 +1,7 @@
|
|||
Check [WILDCARD]/test.ts
|
||||
running 1 test from ./test.ts
|
||||
add() ... ok ([WILDCARD])
|
||||
|
||||
ok | 1 passed | 0 failed ([WILDCARD])
|
||||
|
||||
[WILDCARD]
|
7
tests/specs/coverage/set_coverage_in_env_var/test.ts
Normal file
7
tests/specs/coverage/set_coverage_in_env_var/test.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { add } from "./source.ts";
|
||||
|
||||
Deno.test("add()", () => {
|
||||
if (add(1, 2) !== 3) {
|
||||
throw new Error("test failed");
|
||||
}
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue