summaryrefslogtreecommitdiff
path: root/cli/fs_util.rs
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2021-08-24 23:23:29 +0800
committerGitHub <noreply@github.com>2021-08-24 17:23:29 +0200
commita7240c5091e757da1285c2f655796d4e62e54bb3 (patch)
tree403e6c36dcf8816f207b51f51a80667f1b2e3acb /cli/fs_util.rs
parent7ae30bcc89829a8e4d101deeb3a977f488ef7a12 (diff)
feat(cli): add --ignore flag to test command (#11712)
Diffstat (limited to 'cli/fs_util.rs')
-rw-r--r--cli/fs_util.rs5
1 files changed, 3 insertions, 2 deletions
diff --git a/cli/fs_util.rs b/cli/fs_util.rs
index cab2d5dad..446c16f27 100644
--- a/cli/fs_util.rs
+++ b/cli/fs_util.rs
@@ -202,6 +202,7 @@ where
/// Specifiers that start with http and https are left intact.
pub fn collect_specifiers<P>(
include: Vec<String>,
+ ignore: &[PathBuf],
predicate: P,
) -> Result<Vec<ModuleSpecifier>, AnyError>
where
@@ -222,7 +223,7 @@ where
let p = normalize_path(&root_path.join(path));
if p.is_dir() {
- let test_files = collect_files(&[p], &[], &predicate).unwrap();
+ let test_files = collect_files(&[p], ignore, &predicate).unwrap();
let mut test_files_as_urls = test_files
.iter()
.map(|f| ModuleSpecifier::from_file_path(f).unwrap())
@@ -491,6 +492,7 @@ mod tests {
root_dir_path.to_str().unwrap().to_string(),
"https://localhost:8080".to_string(),
],
+ &[ignore_dir_path],
|path| {
// exclude dotfiles
path
@@ -515,7 +517,6 @@ mod tests {
&format!("{}/child/e.mjs", root_dir_url),
&format!("{}/child/f.mjsx", root_dir_url),
&format!("{}/d.jsx", root_dir_url),
- &format!("{}/ignore/g.d.ts", root_dir_url),
"https://localhost:8080",
]
.iter()