1
0
Fork 0
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:
Casper Beyer 2021-09-01 17:31:56 +08:00 committed by GitHub
parent c49eee551f
commit 77ead8af20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 3 deletions

View file

@ -67,6 +67,12 @@ itest!(doc {
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 {
args: "test --doc --allow-all test/markdown.md",
exit_code: 1,

5
cli/tests/testdata/test/doc_only.out vendored Normal file
View 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
View 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",
);
});

View file

@ -757,9 +757,7 @@ async fn fetch_specifiers_with_test_mode(
.fetch(specifier, &mut Permissions::allow_all())
.await?;
if file.media_type != MediaType::Unknown {
*mode = TestMode::Both
} else {
if file.media_type == MediaType::Unknown {
*mode = TestMode::Documentation
}
}