summaryrefslogtreecommitdiff
path: root/cli/fs_util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/fs_util.rs')
-rw-r--r--cli/fs_util.rs10
1 files changed, 10 insertions, 0 deletions
diff --git a/cli/fs_util.rs b/cli/fs_util.rs
index 462bbdddb..4fcae38f4 100644
--- a/cli/fs_util.rs
+++ b/cli/fs_util.rs
@@ -111,6 +111,16 @@ pub fn is_supported_ext_fmt(path: &Path) -> bool {
false
}
}
+/// Checks if the path has extension Deno supports.
+/// This function is similar to is_supported_ext but adds additional extensions
+/// supported by `deno test`.
+pub fn is_supported_ext_test(path: &Path) -> bool {
+ if let Some(ext) = get_extension(path) {
+ matches!(ext.as_str(), "ts" | "tsx" | "js" | "jsx" | "mjs" | "md")
+ } else {
+ false
+ }
+}
/// Get the extension of a file in lowercase.
pub fn get_extension(file_path: &Path) -> Option<String> {