From 9c1ab39e19073501618947ffa370ba59b04ec6cc Mon Sep 17 00:00:00 2001 From: David Sherret Date: Wed, 7 Dec 2022 13:10:10 -0500 Subject: feat: ignore `node_modules` and `.git` folders when collecting files everywhere (#16862) We currently only do this for fmt. This makes it so they're excluded by default, but you can still opt into these directories by explicitly specifying them. --- cli/tools/coverage/mod.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'cli/tools/coverage/mod.rs') diff --git a/cli/tools/coverage/mod.rs b/cli/tools/coverage/mod.rs index f19cdfa3f..aacaf3d83 100644 --- a/cli/tools/coverage/mod.rs +++ b/cli/tools/coverage/mod.rs @@ -6,7 +6,7 @@ use crate::colors; use crate::emit::get_source_hash; use crate::proc_state::ProcState; use crate::tools::fmt::format_json; -use crate::util::fs::collect_files; +use crate::util::fs::FileCollector; use crate::util::text_encoding::source_map_from_code; use deno_ast::MediaType; @@ -558,9 +558,13 @@ fn collect_coverages( ignore: Vec, ) -> Result, AnyError> { let mut coverages: Vec = Vec::new(); - let file_paths = collect_files(&files, &ignore, |file_path| { + let file_paths = FileCollector::new(|file_path| { file_path.extension().map_or(false, |ext| ext == "json") - })?; + }) + .ignore_git_folder() + .ignore_node_modules() + .add_ignore_paths(&ignore) + .collect_files(&files)?; for file_path in file_paths { let json = fs::read_to_string(file_path.as_path())?; -- cgit v1.2.3