summaryrefslogtreecommitdiff
path: root/cli/fs_util.rs
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-07-30 03:03:06 +0800
committerGitHub <noreply@github.com>2021-07-29 21:03:06 +0200
commitc276b52828c3ea302a3870d0a4cfdc8904da0e93 (patch)
tree62cd3793b80b98e85023388f6c8cc2da5bb49754 /cli/fs_util.rs
parentd0ec29b493f7b0d201368e97f7f89f305c1a7d86 (diff)
feat: type check codeblocks in Markdown file with "deno test --doc" (#11421)
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> {