mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
fix(cli): Default to auto with --node-modules-dir flag (#25772)
Fixes a regression where we were ignoring `--node-modules-dir` if there was no value passed with it. We should instead default to "auto", to maintain compat with deno 1
This commit is contained in:
parent
94bdebe399
commit
4b131d24a7
1 changed files with 21 additions and 1 deletions
|
@ -3896,6 +3896,7 @@ fn node_modules_dir_arg() -> Arg {
|
||||||
Arg::new("node-modules-dir")
|
Arg::new("node-modules-dir")
|
||||||
.long("node-modules-dir")
|
.long("node-modules-dir")
|
||||||
.num_args(0..=1)
|
.num_args(0..=1)
|
||||||
|
.default_missing_value("auto")
|
||||||
.value_parser(clap::builder::ValueParser::new(parse_node_modules_dir_mode))
|
.value_parser(clap::builder::ValueParser::new(parse_node_modules_dir_mode))
|
||||||
.value_name("MODE")
|
.value_name("MODE")
|
||||||
.require_equals(true)
|
.require_equals(true)
|
||||||
|
@ -8494,7 +8495,7 @@ mod tests {
|
||||||
watch: None,
|
watch: None,
|
||||||
bare: true,
|
bare: true,
|
||||||
}),
|
}),
|
||||||
node_modules_dir: None,
|
node_modules_dir: Some(NodeModulesDirMode::Auto),
|
||||||
code_cache_enabled: true,
|
code_cache_enabled: true,
|
||||||
..Flags::default()
|
..Flags::default()
|
||||||
}
|
}
|
||||||
|
@ -10815,4 +10816,23 @@ mod tests {
|
||||||
"error: invalid value 'https://example.com': URLs are not supported, only domains and ips"
|
"error: invalid value 'https://example.com': URLs are not supported, only domains and ips"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn node_modules_dir_default() {
|
||||||
|
let r =
|
||||||
|
flags_from_vec(svec!["deno", "run", "--node-modules-dir", "./foo.ts"]);
|
||||||
|
let flags = r.unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
flags,
|
||||||
|
Flags {
|
||||||
|
subcommand: DenoSubcommand::Run(RunFlags {
|
||||||
|
script: "./foo.ts".into(),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
|
node_modules_dir: Some(NodeModulesDirMode::Auto),
|
||||||
|
code_cache_enabled: true,
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue