diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2024-09-20 15:04:22 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-20 15:04:22 +0900 |
commit | 66fb81ea8581bc7f485c99423c307c8fa548b2fe (patch) | |
tree | 71be94cdb830bd03fd90008c1e58b867f5f3fd62 /tests/specs/coverage | |
parent | a01dce3a25e0bf671c6c21bd6ff57861be613087 (diff) |
fix(coverage): ignore urls from doc testing (#25736)
Diffstat (limited to 'tests/specs/coverage')
5 files changed, 47 insertions, 0 deletions
diff --git a/tests/specs/coverage/filter_doc_testing_urls/__test__.jsonc b/tests/specs/coverage/filter_doc_testing_urls/__test__.jsonc new file mode 100644 index 000000000..9bd4dd829 --- /dev/null +++ b/tests/specs/coverage/filter_doc_testing_urls/__test__.jsonc @@ -0,0 +1,15 @@ +{ + "tempDir": true, + "steps": [ + { + "args": "test -A --coverage --doc", + "output": "test_coverage.out", + "exitCode": 0 + }, + { + "args": "coverage", + "output": "coverage_success.out", + "exitCode": 0 + } + ] +} diff --git a/tests/specs/coverage/filter_doc_testing_urls/coverage_success.out b/tests/specs/coverage/filter_doc_testing_urls/coverage_success.out new file mode 100644 index 000000000..eb55868b0 --- /dev/null +++ b/tests/specs/coverage/filter_doc_testing_urls/coverage_success.out @@ -0,0 +1,7 @@ +-------------------------------- +File | Branch % | Line % | +-------------------------------- + source.ts | 100.0 | 100.0 | +-------------------------------- + All files | 100.0 | 100.0 | +-------------------------------- diff --git a/tests/specs/coverage/filter_doc_testing_urls/source.ts b/tests/specs/coverage/filter_doc_testing_urls/source.ts new file mode 100644 index 000000000..efe56c818 --- /dev/null +++ b/tests/specs/coverage/filter_doc_testing_urls/source.ts @@ -0,0 +1,9 @@ +/** + * @example Usage + * ```ts + * add(1, 2); // 3 + * ``` + */ +export function add(a: number, b: number): number { + return a + b; +} diff --git a/tests/specs/coverage/filter_doc_testing_urls/test.ts b/tests/specs/coverage/filter_doc_testing_urls/test.ts new file mode 100644 index 000000000..46be64c63 --- /dev/null +++ b/tests/specs/coverage/filter_doc_testing_urls/test.ts @@ -0,0 +1,7 @@ +import { add } from "./source.ts"; + +Deno.test("add()", () => { + if (add(1, 2) !== 3) { + throw new Error("test failed"); + } +}); diff --git a/tests/specs/coverage/filter_doc_testing_urls/test_coverage.out b/tests/specs/coverage/filter_doc_testing_urls/test_coverage.out new file mode 100644 index 000000000..65548061a --- /dev/null +++ b/tests/specs/coverage/filter_doc_testing_urls/test_coverage.out @@ -0,0 +1,9 @@ +Check [WILDCARD]/test.ts +Check [WILDCARD]/source.ts$[WILDCARD].ts +running 1 test from ./test.ts +add() ... ok ([WILDCARD]) +running 1 test from ./source.ts$[WILDCARD].ts +file:///[WILDCARD]/source.ts$[WILDCARD].ts ... ok ([WILDCARD]) + +ok | 2 passed | 0 failed ([WILDCARD]) + |