diff options
Diffstat (limited to 'cli/tools/test.rs')
-rw-r--r-- | cli/tools/test.rs | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/cli/tools/test.rs b/cli/tools/test.rs index f78e32539..bc8f68599 100644 --- a/cli/tools/test.rs +++ b/cli/tools/test.rs @@ -39,6 +39,7 @@ use deno_core::task::spawn_blocking; use deno_core::url::Url; use deno_core::v8; use deno_core::ModuleSpecifier; +use deno_graph::GraphKind; use deno_runtime::deno_io::Stdio; use deno_runtime::deno_io::StdioPipe; use deno_runtime::fmt_errors::format_js_error; @@ -1706,7 +1707,11 @@ pub async fn run_tests_with_watch( // file would have impact on other files, which is undesirable. let permissions = Permissions::from_options(&cli_options.permissions_options())?; - let no_check = cli_options.type_check_mode() == TypeCheckMode::None; + let type_check = cli_options.type_check_mode() != TypeCheckMode::None; + let graph_kind = match type_check { + true => GraphKind::All, + false => GraphKind::CodeOnly, + }; let log_level = cli_options.log_level(); let resolver = |changed: Option<Vec<PathBuf>>| { @@ -1731,7 +1736,7 @@ pub async fn run_tests_with_watch( test_modules.clone() }; let graph = module_graph_builder - .create_graph(test_modules.clone()) + .create_graph(graph_kind, test_modules.clone()) .await?; graph_valid_with_cli_options(&graph, &test_modules, &cli_options)?; @@ -1743,32 +1748,19 @@ pub async fn run_tests_with_watch( // This needs to be accessible to skip getting dependencies if they're already there, // otherwise this will cause a stack overflow with circular dependencies output: &mut HashSet<&'a ModuleSpecifier>, - no_check: bool, ) { if let Some(module) = maybe_module.and_then(|m| m.esm()) { for dep in module.dependencies.values() { if let Some(specifier) = &dep.get_code() { if !output.contains(specifier) { output.insert(specifier); - get_dependencies( - graph, - graph.get(specifier), - output, - no_check, - ); + get_dependencies(graph, graph.get(specifier), output); } } - if !no_check { - if let Some(specifier) = &dep.get_type() { - if !output.contains(specifier) { - output.insert(specifier); - get_dependencies( - graph, - graph.get(specifier), - output, - no_check, - ); - } + if let Some(specifier) = &dep.get_type() { + if !output.contains(specifier) { + output.insert(specifier); + get_dependencies(graph, graph.get(specifier), output); } } } @@ -1778,7 +1770,7 @@ pub async fn run_tests_with_watch( // This test module and all it's dependencies let mut modules = HashSet::new(); modules.insert(&specifier); - get_dependencies(&graph, graph.get(&specifier), &mut modules, no_check); + get_dependencies(&graph, graph.get(&specifier), &mut modules); paths_to_watch.extend( modules |