diff --git a/cli/flags.rs b/cli/flags.rs index f4f162dcd0..cc051f7a70 100644 --- a/cli/flags.rs +++ b/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] diff --git a/cli/tests/integration/info_tests.rs b/cli/tests/integration/info_tests.rs index d266daee0b..e02bb8ff22 100644 --- a/cli/tests/integration/info_tests.rs +++ b/cli/tests/integration/info_tests.rs @@ -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", +}); diff --git a/cli/tests/testdata/info/with_config/deno-override.json b/cli/tests/testdata/info/with_config/deno-override.json new file mode 100644 index 0000000000..ee44ba9472 --- /dev/null +++ b/cli/tests/testdata/info/with_config/deno-override.json @@ -0,0 +1,3 @@ +{ + "importMap": "import_map.json" +} diff --git a/cli/tests/testdata/info/with_config/deno.json b/cli/tests/testdata/info/with_config/deno.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/cli/tests/testdata/info/with_config/deno.json @@ -0,0 +1 @@ +{} diff --git a/cli/tests/testdata/info/with_config/import_map.json b/cli/tests/testdata/info/with_config/import_map.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/cli/tests/testdata/info/with_config/import_map.json @@ -0,0 +1 @@ +{} diff --git a/cli/tests/testdata/info/with_config/test.ts b/cli/tests/testdata/info/with_config/test.ts new file mode 100644 index 0000000000..85ce559e8f --- /dev/null +++ b/cli/tests/testdata/info/with_config/test.ts @@ -0,0 +1 @@ +console.log("foo"); diff --git a/cli/tests/testdata/info/with_config/with_config.out b/cli/tests/testdata/info/with_config/with_config.out new file mode 100644 index 0000000000..b707c24d0e --- /dev/null +++ b/cli/tests/testdata/info/with_config/with_config.out @@ -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])