mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
refactor(cli/tools/test): infer disable log from program state (#11803)
This commit is contained in:
parent
dbcdd3a18e
commit
2c17045aa8
3 changed files with 2 additions and 18 deletions
|
@ -102,7 +102,6 @@ pub enum DenoSubcommand {
|
||||||
doc: bool,
|
doc: bool,
|
||||||
no_run: bool,
|
no_run: bool,
|
||||||
fail_fast: Option<NonZeroUsize>,
|
fail_fast: Option<NonZeroUsize>,
|
||||||
quiet: bool,
|
|
||||||
allow_none: bool,
|
allow_none: bool,
|
||||||
include: Option<Vec<String>>,
|
include: Option<Vec<String>>,
|
||||||
filter: Option<String>,
|
filter: Option<String>,
|
||||||
|
@ -1772,7 +1771,6 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
|
||||||
let no_run = matches.is_present("no-run");
|
let no_run = matches.is_present("no-run");
|
||||||
let doc = matches.is_present("doc");
|
let doc = matches.is_present("doc");
|
||||||
let allow_none = matches.is_present("allow-none");
|
let allow_none = matches.is_present("allow-none");
|
||||||
let quiet = matches.is_present("quiet");
|
|
||||||
let filter = matches.value_of("filter").map(String::from);
|
let filter = matches.value_of("filter").map(String::from);
|
||||||
|
|
||||||
let fail_fast = if matches.is_present("fail-fast") {
|
let fail_fast = if matches.is_present("fail-fast") {
|
||||||
|
@ -1837,7 +1835,6 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
|
||||||
no_run,
|
no_run,
|
||||||
doc,
|
doc,
|
||||||
fail_fast,
|
fail_fast,
|
||||||
quiet,
|
|
||||||
include,
|
include,
|
||||||
filter,
|
filter,
|
||||||
shuffle,
|
shuffle,
|
||||||
|
@ -3566,7 +3563,6 @@ mod tests {
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: Some("- foo".to_string()),
|
filter: Some("- foo".to_string()),
|
||||||
allow_none: true,
|
allow_none: true,
|
||||||
quiet: false,
|
|
||||||
include: Some(svec!["dir1/", "dir2/"]),
|
include: Some(svec!["dir1/", "dir2/"]),
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
||||||
|
@ -3634,7 +3630,6 @@ mod tests {
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
allow_none: false,
|
||||||
quiet: false,
|
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
include: None,
|
include: None,
|
||||||
concurrent_jobs: NonZeroUsize::new(4).unwrap(),
|
concurrent_jobs: NonZeroUsize::new(4).unwrap(),
|
||||||
|
@ -3659,7 +3654,6 @@ mod tests {
|
||||||
fail_fast: Some(NonZeroUsize::new(3).unwrap()),
|
fail_fast: Some(NonZeroUsize::new(3).unwrap()),
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
allow_none: false,
|
||||||
quiet: false,
|
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
include: None,
|
include: None,
|
||||||
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
||||||
|
@ -3688,7 +3682,6 @@ mod tests {
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
allow_none: false,
|
||||||
quiet: false,
|
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
include: None,
|
include: None,
|
||||||
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
||||||
|
@ -3711,7 +3704,6 @@ mod tests {
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
allow_none: false,
|
||||||
quiet: false,
|
|
||||||
shuffle: Some(1),
|
shuffle: Some(1),
|
||||||
include: None,
|
include: None,
|
||||||
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
||||||
|
@ -3734,7 +3726,6 @@ mod tests {
|
||||||
fail_fast: None,
|
fail_fast: None,
|
||||||
filter: None,
|
filter: None,
|
||||||
allow_none: false,
|
allow_none: false,
|
||||||
quiet: false,
|
|
||||||
shuffle: None,
|
shuffle: None,
|
||||||
include: None,
|
include: None,
|
||||||
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
concurrent_jobs: NonZeroUsize::new(1).unwrap(),
|
||||||
|
|
|
@ -1005,7 +1005,6 @@ async fn test_command(
|
||||||
no_run: bool,
|
no_run: bool,
|
||||||
doc: bool,
|
doc: bool,
|
||||||
fail_fast: Option<NonZeroUsize>,
|
fail_fast: Option<NonZeroUsize>,
|
||||||
quiet: bool,
|
|
||||||
allow_none: bool,
|
allow_none: bool,
|
||||||
filter: Option<String>,
|
filter: Option<String>,
|
||||||
shuffle: Option<u64>,
|
shuffle: Option<u64>,
|
||||||
|
@ -1216,7 +1215,6 @@ async fn test_command(
|
||||||
test_modules_to_reload,
|
test_modules_to_reload,
|
||||||
no_run,
|
no_run,
|
||||||
fail_fast,
|
fail_fast,
|
||||||
quiet,
|
|
||||||
true,
|
true,
|
||||||
filter.clone(),
|
filter.clone(),
|
||||||
shuffle,
|
shuffle,
|
||||||
|
@ -1252,7 +1250,6 @@ async fn test_command(
|
||||||
test_modules,
|
test_modules,
|
||||||
no_run,
|
no_run,
|
||||||
fail_fast,
|
fail_fast,
|
||||||
quiet,
|
|
||||||
allow_none,
|
allow_none,
|
||||||
filter,
|
filter,
|
||||||
shuffle,
|
shuffle,
|
||||||
|
@ -1355,7 +1352,6 @@ fn get_subcommand(
|
||||||
no_run,
|
no_run,
|
||||||
doc,
|
doc,
|
||||||
fail_fast,
|
fail_fast,
|
||||||
quiet,
|
|
||||||
include,
|
include,
|
||||||
allow_none,
|
allow_none,
|
||||||
filter,
|
filter,
|
||||||
|
@ -1367,7 +1363,6 @@ fn get_subcommand(
|
||||||
no_run,
|
no_run,
|
||||||
doc,
|
doc,
|
||||||
fail_fast,
|
fail_fast,
|
||||||
quiet,
|
|
||||||
allow_none,
|
allow_none,
|
||||||
filter,
|
filter,
|
||||||
shuffle,
|
shuffle,
|
||||||
|
|
|
@ -21,6 +21,7 @@ use deno_core::serde_json::json;
|
||||||
use deno_core::JsRuntime;
|
use deno_core::JsRuntime;
|
||||||
use deno_core::ModuleSpecifier;
|
use deno_core::ModuleSpecifier;
|
||||||
use deno_runtime::permissions::Permissions;
|
use deno_runtime::permissions::Permissions;
|
||||||
|
use log::Level;
|
||||||
use rand::rngs::SmallRng;
|
use rand::rngs::SmallRng;
|
||||||
use rand::seq::SliceRandom;
|
use rand::seq::SliceRandom;
|
||||||
use rand::SeedableRng;
|
use rand::SeedableRng;
|
||||||
|
@ -200,7 +201,6 @@ pub async fn test_specifier(
|
||||||
program_state: Arc<ProgramState>,
|
program_state: Arc<ProgramState>,
|
||||||
main_module: ModuleSpecifier,
|
main_module: ModuleSpecifier,
|
||||||
permissions: Permissions,
|
permissions: Permissions,
|
||||||
quiet: bool,
|
|
||||||
filter: Option<String>,
|
filter: Option<String>,
|
||||||
shuffle: Option<u64>,
|
shuffle: Option<u64>,
|
||||||
channel: Sender<TestEvent>,
|
channel: Sender<TestEvent>,
|
||||||
|
@ -228,7 +228,7 @@ pub async fn test_specifier(
|
||||||
test_source.push_str(&format!(
|
test_source.push_str(&format!(
|
||||||
"await Deno[Deno.internal].runTests({});\n",
|
"await Deno[Deno.internal].runTests({});\n",
|
||||||
json!({
|
json!({
|
||||||
"disableLog": quiet,
|
"disableLog": program_state.flags.log_level == Some(Level::Error),
|
||||||
"filter": filter,
|
"filter": filter,
|
||||||
"shuffle": shuffle,
|
"shuffle": shuffle,
|
||||||
}),
|
}),
|
||||||
|
@ -470,7 +470,6 @@ pub async fn run_tests(
|
||||||
test_modules: Vec<ModuleSpecifier>,
|
test_modules: Vec<ModuleSpecifier>,
|
||||||
no_run: bool,
|
no_run: bool,
|
||||||
fail_fast: Option<NonZeroUsize>,
|
fail_fast: Option<NonZeroUsize>,
|
||||||
quiet: bool,
|
|
||||||
allow_none: bool,
|
allow_none: bool,
|
||||||
filter: Option<String>,
|
filter: Option<String>,
|
||||||
shuffle: Option<u64>,
|
shuffle: Option<u64>,
|
||||||
|
@ -559,7 +558,6 @@ pub async fn run_tests(
|
||||||
program_state,
|
program_state,
|
||||||
main_module,
|
main_module,
|
||||||
permissions,
|
permissions,
|
||||||
quiet,
|
|
||||||
filter,
|
filter,
|
||||||
shuffle,
|
shuffle,
|
||||||
sender,
|
sender,
|
||||||
|
|
Loading…
Reference in a new issue