summaryrefslogtreecommitdiff
path: root/cli/tools/test_runner.rs
diff options
context:
space:
mode:
authorSatya Rohith <me@satyarohith.com>2021-05-19 17:10:23 +0530
committerGitHub <noreply@github.com>2021-05-19 07:40:23 -0400
commit6e1e33ce8843ceb8327066cff8191b141bac9490 (patch)
tree494b989edfd966009c373cf073f682fe09f2bc9a /cli/tools/test_runner.rs
parentef5e5f5e460b40b2c5f7cbcf0a1d11488fc7277f (diff)
fix(deno install): support `file:` scheme URLs (#10562)
Diffstat (limited to 'cli/tools/test_runner.rs')
-rw-r--r--cli/tools/test_runner.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/cli/tools/test_runner.rs b/cli/tools/test_runner.rs
index 6b2eab36b..a2bd0edea 100644
--- a/cli/tools/test_runner.rs
+++ b/cli/tools/test_runner.rs
@@ -11,7 +11,6 @@ use crate::module_graph;
use crate::program_state::ProgramState;
use crate::tokio_util;
use crate::tools::coverage::CoverageCollector;
-use crate::tools::installer::is_remote_url;
use deno_core::error::AnyError;
use deno_core::futures::future;
use deno_core::futures::stream;
@@ -226,6 +225,11 @@ pub(crate) fn is_supported(p: &Path) -> bool {
}
}
+pub fn is_remote_url(module_url: &str) -> bool {
+ let lower = module_url.to_lowercase();
+ lower.starts_with("http://") || lower.starts_with("https://")
+}
+
pub fn collect_test_module_specifiers<P>(
include: Vec<String>,
root_path: &Path,
@@ -642,4 +646,14 @@ mod tests {
.collect();
assert_eq!(matched_urls, expected);
}
+
+ #[test]
+ fn test_is_remote_url() {
+ assert!(is_remote_url("https://deno.land/std/http/file_server.ts"));
+ assert!(is_remote_url("http://deno.land/std/http/file_server.ts"));
+ assert!(is_remote_url("HTTP://deno.land/std/http/file_server.ts"));
+ assert!(is_remote_url("HTTp://deno.land/std/http/file_server.ts"));
+ assert!(!is_remote_url("file:///dev/deno_std/http/file_server.ts"));
+ assert!(!is_remote_url("./dev/deno_std/http/file_server.ts"));
+ }
}