1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00

fix(cli): revert "never type check deno info #6978" (#7199)

This commit is contained in:
Luca Casonato 2020-08-26 20:27:06 +02:00 committed by GitHub
parent c8b5f1e454
commit a7fd3a4f58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 19 additions and 61 deletions

View file

@ -476,7 +476,7 @@ fn info_parse(flags: &mut Flags, matches: &clap::ArgMatches) {
ca_file_arg_parse(flags, matches); ca_file_arg_parse(flags, matches);
unstable_arg_parse(flags, matches); unstable_arg_parse(flags, matches);
let json = matches.is_present("json"); let json = matches.is_present("json");
flags.no_check = true; no_check_arg_parse(flags, matches);
flags.subcommand = DenoSubcommand::Info { flags.subcommand = DenoSubcommand::Info {
file: matches.value_of("file").map(|f| f.to_string()), file: matches.value_of("file").map(|f| f.to_string()),
json, json,
@ -870,10 +870,7 @@ TypeScript compiler cache: Subdirectory containing TS compiler output.",
.arg(Arg::with_name("file").takes_value(true).required(false)) .arg(Arg::with_name("file").takes_value(true).required(false))
.arg(reload_arg().requires("file")) .arg(reload_arg().requires("file"))
.arg(ca_file_arg()) .arg(ca_file_arg())
// TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it .arg(no_check_arg())
// shouldn't cause flag parsing to fail for backward-compatibility. Remove
// this line for v2.0.0.
.arg(no_check_arg().hidden(true))
.arg(unstable_arg()) .arg(unstable_arg())
.arg( .arg(
Arg::with_name("json") Arg::with_name("json")
@ -1907,7 +1904,6 @@ mod tests {
json: false, json: false,
file: Some("script.ts".to_string()), file: Some("script.ts".to_string()),
}, },
no_check: true,
..Flags::default() ..Flags::default()
} }
); );
@ -1921,7 +1917,6 @@ mod tests {
file: Some("script.ts".to_string()), file: Some("script.ts".to_string()),
}, },
reload: true, reload: true,
no_check: true,
..Flags::default() ..Flags::default()
} }
); );
@ -1934,7 +1929,6 @@ mod tests {
json: true, json: true,
file: Some("script.ts".to_string()), file: Some("script.ts".to_string()),
}, },
no_check: true,
..Flags::default() ..Flags::default()
} }
); );
@ -1947,7 +1941,6 @@ mod tests {
json: false, json: false,
file: None file: None
}, },
no_check: true,
..Flags::default() ..Flags::default()
} }
); );
@ -1960,7 +1953,6 @@ mod tests {
json: true, json: true,
file: None file: None
}, },
no_check: true,
..Flags::default() ..Flags::default()
} }
); );
@ -2683,50 +2675,6 @@ mod tests {
..Flags::default() ..Flags::default()
} }
); );
let r =
flags_from_vec_safe(svec!["deno", "test", "--no-check", "script.ts"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Test {
fail_fast: false,
filter: None,
allow_none: false,
quiet: false,
include: Some(svec!["script.ts"]),
},
no_check: true,
..Flags::default()
}
);
let r =
flags_from_vec_safe(svec!["deno", "cache", "--no-check", "script.ts"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Cache {
files: svec!["script.ts"],
},
no_check: true,
..Flags::default()
}
);
// TODO(nayeemrmn): `--no-check` has been removed for `deno info`, but it
// shouldn't cause flag parsing to fail for backward-compatibility. Remove
// this test for v2.0.0.
let r =
flags_from_vec_safe(svec!["deno", "info", "--no-check", "script.ts"]);
assert_eq!(
r.unwrap(),
Flags {
subcommand: DenoSubcommand::Info {
json: false,
file: Some("script.ts".to_string()),
},
no_check: true,
..Flags::default()
}
);
} }
#[test] #[test]
@ -3066,7 +3014,6 @@ mod tests {
file: Some("https://example.com".to_string()), file: Some("https://example.com".to_string()),
}, },
ca_file: Some("example.crt".to_owned()), ca_file: Some("example.crt".to_owned()),
no_check: true,
..Flags::default() ..Flags::default()
} }
); );

View file

@ -0,0 +1,7 @@
Check [WILDCARD]info_type_import.ts
local: [WILDCARD]info_type_import.ts
type: TypeScript
compiled: [WILDCARD]
deps:
[WILDCARD]info_type_import.ts
└── [WILDCARD]type_and_code.ts

View file

@ -0,0 +1,3 @@
import { AnInterface as _, isAnInterface } from "./subdir/type_and_code.ts";
isAnInterface({});

View file

@ -1446,9 +1446,8 @@ itest!(_030_eval_ts {
}); });
itest!(_031_info_no_check { itest!(_031_info_no_check {
args: "info 031_info_no_check.ts", args: "info --no-check 031_info_no_check.ts",
output: "031_info_no_check.out", output: "031_info_no_check.out",
http_server: true,
}); });
itest!(_033_import_map { itest!(_033_import_map {
@ -1544,10 +1543,7 @@ itest!(_048_media_types_jsx {
http_server: true, http_server: true,
}); });
// TODO(nayeemrmn): This hits an SWC type-stripping bug: itest!(_049_info_flag_script_jsx {
// `error: Unterminated regexp literal at http://localhost:4545/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx:4:19`
// Re-enable once fixed.
itest_ignore!(_049_info_flag_script_jsx {
args: "info http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts", args: "info http://127.0.0.1:4545/cli/tests/048_media_types_jsx.ts",
output: "049_info_flag_script_jsx.out", output: "049_info_flag_script_jsx.out",
http_server: true, http_server: true,
@ -2284,6 +2280,11 @@ itest!(import_file_with_colon {
http_server: true, http_server: true,
}); });
itest!(info_type_import {
args: "info info_type_import.ts",
output: "info_type_import.out",
});
#[test] #[test]
fn cafile_env_fetch() { fn cafile_env_fetch() {
use url::Url; use url::Url;