mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 23:34:47 -05:00
fix(cli): retain path based test mode inference (#11878)
This commit is contained in:
parent
c49eee551f
commit
77ead8af20
4 changed files with 22 additions and 3 deletions
|
@ -67,6 +67,12 @@ itest!(doc {
|
||||||
output: "test/doc.out",
|
output: "test/doc.out",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
itest!(doc_only {
|
||||||
|
args: "test --doc --allow-all test/doc_only",
|
||||||
|
exit_code: 0,
|
||||||
|
output: "test/doc_only.out",
|
||||||
|
});
|
||||||
|
|
||||||
itest!(markdown {
|
itest!(markdown {
|
||||||
args: "test --doc --allow-all test/markdown.md",
|
args: "test --doc --allow-all test/markdown.md",
|
||||||
exit_code: 1,
|
exit_code: 1,
|
||||||
|
|
5
cli/tests/testdata/test/doc_only.out
vendored
Normal file
5
cli/tests/testdata/test/doc_only.out
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
Check [WILDCARD]/test/doc_only/mod.ts$2-5.ts
|
||||||
|
running 0 tests from [WILDCARD]/test/doc_only/mod.ts
|
||||||
|
|
||||||
|
test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
|
||||||
|
|
10
cli/tests/testdata/test/doc_only/mod.ts
vendored
Normal file
10
cli/tests/testdata/test/doc_only/mod.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
/**
|
||||||
|
* ```ts
|
||||||
|
* import "./mod.ts";
|
||||||
|
* ```
|
||||||
|
*/
|
||||||
|
Deno.test("unreachable", function () {
|
||||||
|
throw new Error(
|
||||||
|
"modules that don't end with _test are scanned for documentation tests only should not be executed",
|
||||||
|
);
|
||||||
|
});
|
|
@ -757,9 +757,7 @@ async fn fetch_specifiers_with_test_mode(
|
||||||
.fetch(specifier, &mut Permissions::allow_all())
|
.fetch(specifier, &mut Permissions::allow_all())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if file.media_type != MediaType::Unknown {
|
if file.media_type == MediaType::Unknown {
|
||||||
*mode = TestMode::Both
|
|
||||||
} else {
|
|
||||||
*mode = TestMode::Documentation
|
*mode = TestMode::Documentation
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue