summaryrefslogtreecommitdiff
path: root/cli/args
diff options
context:
space:
mode:
authorHajime-san <41257923+Hajime-san@users.noreply.github.com>2024-08-20 10:27:36 +0900
committerGitHub <noreply@github.com>2024-08-20 01:27:36 +0000
commit19bcb40059f6ba730b6d05d8edf005c6b40f6ff8 (patch)
treee7c60d8957a8609199a3dad24455518cc36fac32 /cli/args
parent4f49f703c10afcde7155baac2b494fa6670c0115 (diff)
feat(cli/tools): add a subcommand `--hide-stacktraces` for test (#24095)
Diffstat (limited to 'cli/args')
-rw-r--r--cli/args/flags.rs38
-rw-r--r--cli/args/mod.rs2
2 files changed, 40 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs
index c3edd8d3f..0ceac4563 100644
--- a/cli/args/flags.rs
+++ b/cli/args/flags.rs
@@ -403,6 +403,7 @@ pub struct TestFlags {
pub watch: Option<WatchFlagsWithPaths>,
pub reporter: TestReporterConfig,
pub junit_path: Option<String>,
+ pub hide_stacktraces: bool,
}
#[derive(Clone, Debug, Eq, PartialEq)]
@@ -2999,6 +3000,12 @@ Directory arguments are expanded to all contained files matching the glob
.value_parser(["pretty", "dot", "junit", "tap"])
.help_heading(TEST_HEADING)
)
+ .arg(
+ Arg::new("hide-stacktraces")
+ .long("hide-stacktraces")
+ .help("Hide stack traces for errors in failure test results.")
+ .action(ArgAction::SetTrue)
+ )
.arg(env_file_arg())
)
}
@@ -4920,6 +4927,8 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) {
flags.log_level = Some(Level::Error);
}
+ let hide_stacktraces = matches.get_flag("hide-stacktraces");
+
flags.subcommand = DenoSubcommand::Test(TestFlags {
no_run,
doc,
@@ -4935,6 +4944,7 @@ fn test_parse(flags: &mut Flags, matches: &mut ArgMatches) {
watch: watch_arg_parse_with_paths(matches),
reporter,
junit_path,
+ hide_stacktraces,
});
}
@@ -9015,6 +9025,7 @@ mod tests {
watch: Default::default(),
reporter: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
unstable_config: UnstableConfig {
legacy_flag_enabled: true,
@@ -9102,6 +9113,7 @@ mod tests {
clean: false,
watch: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
type_check_mode: TypeCheckMode::Local,
permissions: PermissionFlags {
@@ -9140,6 +9152,7 @@ mod tests {
watch: Default::default(),
reporter: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
type_check_mode: TypeCheckMode::Local,
permissions: PermissionFlags {
@@ -9182,6 +9195,7 @@ mod tests {
watch: Default::default(),
reporter: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
permissions: PermissionFlags {
no_prompt: true,
@@ -9318,6 +9332,7 @@ mod tests {
watch: Default::default(),
reporter: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
permissions: PermissionFlags {
no_prompt: true,
@@ -9353,6 +9368,7 @@ mod tests {
watch: Some(Default::default()),
reporter: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
permissions: PermissionFlags {
no_prompt: true,
@@ -9387,6 +9403,7 @@ mod tests {
watch: Some(Default::default()),
reporter: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
permissions: PermissionFlags {
no_prompt: true,
@@ -9428,6 +9445,7 @@ mod tests {
}),
reporter: Default::default(),
junit_path: None,
+ hide_stacktraces: false,
}),
type_check_mode: TypeCheckMode::Local,
permissions: PermissionFlags {
@@ -9625,6 +9643,26 @@ mod tests {
}
#[test]
+ fn test_hide_stacktraces() {
+ let r = flags_from_vec(svec!["deno", "test", "--hide-stacktraces"]);
+ assert_eq!(
+ r.unwrap(),
+ Flags {
+ subcommand: DenoSubcommand::Test(TestFlags {
+ hide_stacktraces: true,
+ ..TestFlags::default()
+ }),
+ type_check_mode: TypeCheckMode::Local,
+ permissions: PermissionFlags {
+ no_prompt: true,
+ ..Default::default()
+ },
+ ..Flags::default()
+ }
+ );
+ }
+
+ #[test]
fn bundle_with_cafile() {
let r = flags_from_vec(svec![
"deno",
diff --git a/cli/args/mod.rs b/cli/args/mod.rs
index 403e4ffdf..68cf916b2 100644
--- a/cli/args/mod.rs
+++ b/cli/args/mod.rs
@@ -377,6 +377,7 @@ pub struct WorkspaceTestOptions {
pub trace_leaks: bool,
pub reporter: TestReporterConfig,
pub junit_path: Option<String>,
+ pub hide_stacktraces: bool,
}
impl WorkspaceTestOptions {
@@ -394,6 +395,7 @@ impl WorkspaceTestOptions {
trace_leaks: test_flags.trace_leaks,
reporter: test_flags.reporter,
junit_path: test_flags.junit_path.clone(),
+ hide_stacktraces: test_flags.hide_stacktraces,
}
}
}