mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
fix(cli): add config flag to deno info
(#14706)
This commit is contained in:
parent
64abb65f05
commit
decdc59071
7 changed files with 32 additions and 0 deletions
15
cli/flags.rs
15
cli/flags.rs
|
@ -1196,6 +1196,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
|
|||
)
|
||||
// TODO(lucacasonato): remove for 2.0
|
||||
.arg(no_check_arg().hide(true))
|
||||
.args(config_args())
|
||||
.arg(import_map_arg())
|
||||
.arg(
|
||||
Arg::new("json")
|
||||
|
@ -2438,6 +2439,7 @@ fn fmt_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
|
|||
|
||||
fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
|
||||
reload_arg_parse(flags, matches);
|
||||
config_args_parse(flags, matches);
|
||||
import_map_arg_parse(flags, matches);
|
||||
location_arg_parse(flags, matches);
|
||||
ca_file_arg_parse(flags, matches);
|
||||
|
@ -3862,6 +3864,19 @@ mod tests {
|
|||
..Flags::default()
|
||||
}
|
||||
);
|
||||
|
||||
let r = flags_from_vec(svec!["deno", "info", "--config", "tsconfig.json"]);
|
||||
assert_eq!(
|
||||
r.unwrap(),
|
||||
Flags {
|
||||
subcommand: DenoSubcommand::Info(InfoFlags {
|
||||
json: false,
|
||||
file: None
|
||||
}),
|
||||
config_flag: ConfigFlag::Path("tsconfig.json".to_owned()),
|
||||
..Flags::default()
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
@ -124,3 +124,8 @@ itest!(deno_info_types_header_direct {
|
|||
output: "info/types_header.out",
|
||||
http_server: true,
|
||||
});
|
||||
|
||||
itest!(deno_info_with_config_override {
|
||||
args: "info info/with_config/test.ts --config info/with_config/deno-override.json --import-map info/with_config/import_map.json",
|
||||
output: "info/with_config/with_config.out",
|
||||
});
|
||||
|
|
3
cli/tests/testdata/info/with_config/deno-override.json
vendored
Normal file
3
cli/tests/testdata/info/with_config/deno-override.json
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"importMap": "import_map.json"
|
||||
}
|
1
cli/tests/testdata/info/with_config/deno.json
vendored
Normal file
1
cli/tests/testdata/info/with_config/deno.json
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
1
cli/tests/testdata/info/with_config/import_map.json
vendored
Normal file
1
cli/tests/testdata/info/with_config/import_map.json
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
{}
|
1
cli/tests/testdata/info/with_config/test.ts
vendored
Normal file
1
cli/tests/testdata/info/with_config/test.ts
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
console.log("foo");
|
6
cli/tests/testdata/info/with_config/with_config.out
vendored
Normal file
6
cli/tests/testdata/info/with_config/with_config.out
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
Warning the configuration file "[WILDCARD]/deno-override.json" contains an entry for "importMap" that is being ignored.
|
||||
local: [WILDCARD]test.ts
|
||||
type: TypeScript
|
||||
dependencies: 0 unique (total [WILDCARD])
|
||||
|
||||
file:///[WILDCARD]/test.ts ([WILDCARD])
|
Loading…
Reference in a new issue