From 2c17045aa8fd6f01b379fbb6e5d29b9df45b9b1b Mon Sep 17 00:00:00 2001 From: Casper Beyer Date: Mon, 23 Aug 2021 22:03:57 +0800 Subject: [PATCH] refactor(cli/tools/test): infer disable log from program state (#11803) --- cli/flags.rs | 9 --------- cli/main.rs | 5 ----- cli/tools/test_runner.rs | 6 ++---- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/cli/flags.rs b/cli/flags.rs index 8236d63db1..53177465da 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -102,7 +102,6 @@ pub enum DenoSubcommand { doc: bool, no_run: bool, fail_fast: Option, - quiet: bool, allow_none: bool, include: Option>, filter: Option, @@ -1772,7 +1771,6 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) { let no_run = matches.is_present("no-run"); let doc = matches.is_present("doc"); let allow_none = matches.is_present("allow-none"); - let quiet = matches.is_present("quiet"); let filter = matches.value_of("filter").map(String::from); let fail_fast = if matches.is_present("fail-fast") { @@ -1837,7 +1835,6 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) { no_run, doc, fail_fast, - quiet, include, filter, shuffle, @@ -3566,7 +3563,6 @@ mod tests { fail_fast: None, filter: Some("- foo".to_string()), allow_none: true, - quiet: false, include: Some(svec!["dir1/", "dir2/"]), shuffle: None, concurrent_jobs: NonZeroUsize::new(1).unwrap(), @@ -3634,7 +3630,6 @@ mod tests { fail_fast: None, filter: None, allow_none: false, - quiet: false, shuffle: None, include: None, concurrent_jobs: NonZeroUsize::new(4).unwrap(), @@ -3659,7 +3654,6 @@ mod tests { fail_fast: Some(NonZeroUsize::new(3).unwrap()), filter: None, allow_none: false, - quiet: false, shuffle: None, include: None, concurrent_jobs: NonZeroUsize::new(1).unwrap(), @@ -3688,7 +3682,6 @@ mod tests { fail_fast: None, filter: None, allow_none: false, - quiet: false, shuffle: None, include: None, concurrent_jobs: NonZeroUsize::new(1).unwrap(), @@ -3711,7 +3704,6 @@ mod tests { fail_fast: None, filter: None, allow_none: false, - quiet: false, shuffle: Some(1), include: None, concurrent_jobs: NonZeroUsize::new(1).unwrap(), @@ -3734,7 +3726,6 @@ mod tests { fail_fast: None, filter: None, allow_none: false, - quiet: false, shuffle: None, include: None, concurrent_jobs: NonZeroUsize::new(1).unwrap(), diff --git a/cli/main.rs b/cli/main.rs index 123f638dab..ad1e156436 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -1005,7 +1005,6 @@ async fn test_command( no_run: bool, doc: bool, fail_fast: Option, - quiet: bool, allow_none: bool, filter: Option, shuffle: Option, @@ -1216,7 +1215,6 @@ async fn test_command( test_modules_to_reload, no_run, fail_fast, - quiet, true, filter.clone(), shuffle, @@ -1252,7 +1250,6 @@ async fn test_command( test_modules, no_run, fail_fast, - quiet, allow_none, filter, shuffle, @@ -1355,7 +1352,6 @@ fn get_subcommand( no_run, doc, fail_fast, - quiet, include, allow_none, filter, @@ -1367,7 +1363,6 @@ fn get_subcommand( no_run, doc, fail_fast, - quiet, allow_none, filter, shuffle, diff --git a/cli/tools/test_runner.rs b/cli/tools/test_runner.rs index a4bc998226..4f287a4e6e 100644 --- a/cli/tools/test_runner.rs +++ b/cli/tools/test_runner.rs @@ -21,6 +21,7 @@ use deno_core::serde_json::json; use deno_core::JsRuntime; use deno_core::ModuleSpecifier; use deno_runtime::permissions::Permissions; +use log::Level; use rand::rngs::SmallRng; use rand::seq::SliceRandom; use rand::SeedableRng; @@ -200,7 +201,6 @@ pub async fn test_specifier( program_state: Arc, main_module: ModuleSpecifier, permissions: Permissions, - quiet: bool, filter: Option, shuffle: Option, channel: Sender, @@ -228,7 +228,7 @@ pub async fn test_specifier( test_source.push_str(&format!( "await Deno[Deno.internal].runTests({});\n", json!({ - "disableLog": quiet, + "disableLog": program_state.flags.log_level == Some(Level::Error), "filter": filter, "shuffle": shuffle, }), @@ -470,7 +470,6 @@ pub async fn run_tests( test_modules: Vec, no_run: bool, fail_fast: Option, - quiet: bool, allow_none: bool, filter: Option, shuffle: Option, @@ -559,7 +558,6 @@ pub async fn run_tests( program_state, main_module, permissions, - quiet, filter, shuffle, sender,