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
committerBert Belder <bertbelder@gmail.com>2021-05-31 16:37:29 +0200
commit7a751b813539f3048e56022248aeef42bb73b3ee (patch)
tree17a4fd5b891d118a013054c5afbf28a16d4c65fd /cli/tools/test_runner.rs
parent44cd0b1ef6d302993288f872cdd0816a581d2d0b (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"));
+ }
}