diff options
Diffstat (limited to 'cli/args/flags.rs')
-rw-r--r-- | cli/args/flags.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/cli/args/flags.rs b/cli/args/flags.rs index 9b0f840e9..5261411ce 100644 --- a/cli/args/flags.rs +++ b/cli/args/flags.rs @@ -417,6 +417,7 @@ pub struct Flags { pub no_prompt: bool, pub reload: bool, pub seed: Option<u64>, + pub strace_ops: Option<Vec<String>>, pub unstable: bool, pub unstable_bare_node_builtins: bool, pub unstable_byonm: bool, @@ -2688,6 +2689,7 @@ fn runtime_args( .arg(v8_flags_arg()) .arg(seed_arg()) .arg(enable_testing_features_arg()) + .arg(strace_ops_arg()) } fn inspect_args(app: Command) -> Command { @@ -2837,6 +2839,17 @@ fn enable_testing_features_arg() -> Arg { .hide(true) } +fn strace_ops_arg() -> Arg { + Arg::new("strace-ops") + .long("strace-ops") + .num_args(0..) + .use_value_delimiter(true) + .require_equals(true) + .value_name("OPS") + .help("Trace low-level op calls") + .hide(true) +} + fn v8_flags_arg() -> Arg { Arg::new("v8-flags") .long("v8-flags") @@ -3802,6 +3815,7 @@ fn permission_args_parse(flags: &mut Flags, matches: &mut ArgMatches) { flags.no_prompt = true; } } + fn unsafely_ignore_certificate_errors_parse( flags: &mut Flags, matches: &mut ArgMatches, @@ -3833,6 +3847,7 @@ fn runtime_args_parse( seed_arg_parse(flags, matches); enable_testing_features_arg_parse(flags, matches); env_file_arg_parse(flags, matches); + strace_ops_parse(flags, matches); } fn inspect_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) { @@ -3900,6 +3915,12 @@ fn enable_testing_features_arg_parse( } } +fn strace_ops_parse(flags: &mut Flags, matches: &mut ArgMatches) { + if let Some(patterns) = matches.remove_many::<String>("strace-ops") { + flags.strace_ops = Some(patterns.collect()); + } +} + fn cached_only_arg_parse(flags: &mut Flags, matches: &mut ArgMatches) { if matches.get_flag("cached-only") { flags.cached_only = true; @@ -5401,6 +5422,19 @@ mod tests { } #[test] + fn repl_strace_ops() { + // Lightly test this undocumented flag + let r = flags_from_vec(svec!["deno", "repl", "--strace-ops"]); + assert_eq!(r.unwrap().strace_ops, Some(vec![])); + let r = + flags_from_vec(svec!["deno", "repl", "--strace-ops=http,websocket"]); + assert_eq!( + r.unwrap().strace_ops, + Some(vec!["http".to_string(), "websocket".to_string()]) + ); + } + + #[test] fn repl_with_flags() { #[rustfmt::skip] let r = flags_from_vec(svec!["deno", "repl", "-A", "--import-map", "import_map.json", "--no-remote", "--config", "tsconfig.json", "--no-check", "--reload", "--lock", "lock.json", "--lock-write", "--cert", "example.crt", "--cached-only", "--location", "https:foo", "--v8-flags=--help", "--seed", "1", "--inspect=127.0.0.1:9229", "--unsafely-ignore-certificate-errors", "--env=.example.env"]); |