summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cli/flags.rs5
-rw-r--r--cli/lib.rs9
-rw-r--r--cli/test_runner.rs5
3 files changed, 13 insertions, 6 deletions
diff --git a/cli/flags.rs b/cli/flags.rs
index b3ada1318..b06637057 100644
--- a/cli/flags.rs
+++ b/cli/flags.rs
@@ -65,6 +65,7 @@ pub enum DenoSubcommand {
},
Test {
fail_fast: bool,
+ quiet: bool,
allow_none: bool,
include: Option<Vec<String>>,
filter: Option<String>,
@@ -546,6 +547,7 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
let failfast = matches.is_present("failfast");
let allow_none = matches.is_present("allow_none");
+ let quiet = matches.is_present("quiet");
let filter = matches.value_of("filter").map(String::from);
let include = if matches.is_present("files") {
let files: Vec<String> = matches
@@ -560,6 +562,7 @@ fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
flags.subcommand = DenoSubcommand::Test {
fail_fast: failfast,
+ quiet,
include,
filter,
allow_none,
@@ -2312,6 +2315,7 @@ mod tests {
fail_fast: false,
filter: None,
allow_none: true,
+ quiet: false,
include: Some(svec!["dir1/", "dir2/"]),
},
allow_read: true,
@@ -2330,6 +2334,7 @@ mod tests {
subcommand: DenoSubcommand::Test {
fail_fast: false,
allow_none: false,
+ quiet: false,
filter: Some("foo".to_string()),
include: Some(svec!["dir1"]),
},
diff --git a/cli/lib.rs b/cli/lib.rs
index 2a13d802d..2cd077ebb 100644
--- a/cli/lib.rs
+++ b/cli/lib.rs
@@ -481,6 +481,7 @@ async fn test_command(
flags: Flags,
include: Option<Vec<String>>,
fail_fast: bool,
+ quiet: bool,
allow_none: bool,
filter: Option<String>,
) -> Result<(), ErrBox> {
@@ -501,7 +502,7 @@ async fn test_command(
let test_file_url =
Url::from_file_path(&test_file_path).expect("Should be valid file url");
let test_file =
- test_runner::render_test_file(test_modules, fail_fast, filter);
+ test_runner::render_test_file(test_modules, fail_fast, quiet, filter);
let main_module =
ModuleSpecifier::resolve_url(&test_file_url.to_string()).unwrap();
let mut worker =
@@ -582,12 +583,12 @@ pub fn main() {
DenoSubcommand::Run { script } => run_command(flags, script).boxed_local(),
DenoSubcommand::Test {
fail_fast,
+ quiet,
include,
allow_none,
filter,
- } => {
- test_command(flags, include, fail_fast, allow_none, filter).boxed_local()
- }
+ } => test_command(flags, include, fail_fast, quiet, allow_none, filter)
+ .boxed_local(),
DenoSubcommand::Completions { buf } => {
if let Err(e) = write_to_stdout_ignore_sigpipe(&buf) {
eprintln!("{}", e);
diff --git a/cli/test_runner.rs b/cli/test_runner.rs
index dd87ab7ec..2aa8427b2 100644
--- a/cli/test_runner.rs
+++ b/cli/test_runner.rs
@@ -63,6 +63,7 @@ pub fn prepare_test_modules_urls(
pub fn render_test_file(
modules: Vec<Url>,
fail_fast: bool,
+ quiet: bool,
filter: Option<String>,
) -> String {
let mut test_file = "".to_string();
@@ -72,9 +73,9 @@ pub fn render_test_file(
}
let options = if let Some(filter) = filter {
- json!({ "failFast": fail_fast, "filter": filter })
+ json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet, "filter": filter })
} else {
- json!({ "failFast": fail_fast })
+ json!({ "failFast": fail_fast, "reportToConsole": !quiet, "disableLog": quiet })
};
let run_tests_cmd = format!("Deno.runTests({});\n", options);