diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-06-13 23:13:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-13 23:13:16 +0200 |
commit | 4a0a412d7cd077ff519b4da8f6ffd1247c6375a5 (patch) | |
tree | e5ad94395d7450db832d77cd158a4218ea50d038 | |
parent | 24571a395203aad7cda07ffef0ef64285351e42b (diff) |
feat: no type-check by default (#14691)
This commit changes default default behavior of type checking
for several subcommands.
Instead of type checking and reporting type errors only for local
files, the type checking is skipped entirely. Type checking can
still be enabled using the "--check" flag.
Following subcomands are affected:
- deno cache
- deno install
- deno eval
- deno run
-rw-r--r-- | cli/flags.rs | 105 | ||||
-rw-r--r-- | cli/main.rs | 35 | ||||
-rw-r--r-- | cli/tests/integration/bundle_tests.rs | 10 | ||||
-rw-r--r-- | cli/tests/integration/cache_tests.rs | 13 | ||||
-rw-r--r-- | cli/tests/integration/eval_tests.rs | 1 | ||||
-rw-r--r-- | cli/tests/integration/inspector_tests.rs | 14 | ||||
-rw-r--r-- | cli/tests/integration/install_tests.rs | 14 | ||||
-rw-r--r-- | cli/tests/integration/mod.rs | 12 | ||||
-rw-r--r-- | cli/tests/integration/run_tests.rs | 99 | ||||
-rw-r--r-- | cli/tests/integration/watcher_tests.rs | 5 | ||||
-rw-r--r-- | cli/tests/testdata/cache/check_local_by_default2.out | 4 | ||||
-rw-r--r-- | cli/tests/testdata/eval/check_local_by_default2.out | 7 | ||||
-rw-r--r-- | cli/tests/testdata/future_check1.out | 1 | ||||
-rw-r--r-- | cli/tools/installer.rs | 37 | ||||
-rw-r--r-- | cli/tools/standalone.rs | 4 |
15 files changed, 92 insertions, 269 deletions
diff --git a/cli/flags.rs b/cli/flags.rs index cc051f7a7..c32398da8 100644 --- a/cli/flags.rs +++ b/cli/flags.rs @@ -64,7 +64,6 @@ pub struct CacheFlags { #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct CheckFlags { pub files: Vec<String>, - pub remote: bool, } #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] @@ -235,42 +234,19 @@ impl Default for DenoSubcommand { #[derive(Debug, Clone, PartialEq)] pub enum TypeCheckMode { - /// Type check all modules. The default value. + /// Type check all modules. All, - /// Skip type checking of all modules. Represents `--no-check` on the command - /// line. + /// Skip type checking of all modules. The default value for "deno run" and + /// several other subcommands. None, - /// Only type check local modules. Represents `--no-check=remote` on the - /// command line. + /// Only type check local modules. The default value for "deno test" and + /// several other subcommands. Local, } impl Default for TypeCheckMode { fn default() -> Self { - // TODO(bartlomieju): in v1.22 we switched to `Local` instead of `All` and - // in v1.23 we will switch to `None` by default. - Self::Local - } -} - -// TODO(bartlomieju): remove once type checking is skipped by default (probably -// in 1.23) -#[derive(Debug, Clone, PartialEq)] -pub enum FutureTypeCheckMode { - /// Type check all modules. Represents `--check=all` on the command line. - All, - /// Skip type checking of all modules. The default value. - None, - /// Only type check local modules. Represents `--check` on the - /// command line. - Local, -} - -impl Default for FutureTypeCheckMode { - fn default() -> Self { - // TODO(bartlomieju): in v1.22 we switched to `Local` instead of `All` and - // in v1.23 we will switch to `None` by default. - Self::Local + Self::None } } @@ -310,12 +286,6 @@ pub struct Flags { pub cache_path: Option<PathBuf>, pub cached_only: bool, pub type_check_mode: TypeCheckMode, - // TODO(bartlomieju): to be removed in v1.23. - pub has_no_check_flag: bool, - // TODO(bartlomieju): to be removed in v1.23. - pub has_check_flag: bool, - // TODO(bartlomieju): to be removed in v1.23. - pub future_type_check_mode: FutureTypeCheckMode, pub config_flag: ConfigFlag, pub coverage_dir: Option<String>, pub enable_testing_features: bool, @@ -508,9 +478,6 @@ static ENV_VARIABLES_HELP: &str = r#"ENVIRONMENT VARIABLES: (defaults to $HOME/.deno/bin) DENO_NO_PROMPT Set to disable permission prompts on access (alternative to passing --no-prompt on invocation) - DENO_FUTURE_CHECK Opt-in to the upcoming behavior of the `deno run` - subcommand that doesn't perform type-checking by - default. DENO_WEBGPU_TRACE Directory to use for wgpu traces HTTP_PROXY Proxy address for HTTP requests (module downloads, fetch) @@ -2162,6 +2129,8 @@ fn unsafely_ignore_certificate_errors_arg<'a>() -> Arg<'a> { } fn bench_parse(flags: &mut Flags, matches: &clap::ArgMatches) { + flags.type_check_mode = TypeCheckMode::Local; + runtime_args_parse(flags, matches, true, false); // NOTE: `deno bench` always uses `--no-prompt`, tests shouldn't ever do @@ -2207,6 +2176,8 @@ fn bench_parse(flags: &mut Flags, matches: &clap::ArgMatches) { } fn bundle_parse(flags: &mut Flags, matches: &clap::ArgMatches) { + flags.type_check_mode = TypeCheckMode::Local; + compile_args_parse(flags, matches); let source_file = matches.value_of("source_file").unwrap().to_string(); @@ -2237,17 +2208,21 @@ fn cache_parse(flags: &mut Flags, matches: &clap::ArgMatches) { } fn check_parse(flags: &mut Flags, matches: &clap::ArgMatches) { + flags.type_check_mode = TypeCheckMode::Local; compile_args_without_no_check_parse(flags, matches); let files = matches .values_of("file") .unwrap() .map(String::from) .collect(); - let remote = matches.is_present("remote"); - flags.subcommand = DenoSubcommand::Check(CheckFlags { files, remote }); + if matches.is_present("remote") { + flags.type_check_mode = TypeCheckMode::All; + } + flags.subcommand = DenoSubcommand::Check(CheckFlags { files }); } fn compile_parse(flags: &mut Flags, matches: &clap::ArgMatches) { + flags.type_check_mode = TypeCheckMode::Local; runtime_args_parse(flags, matches, true, false); let mut script: Vec<String> = matches @@ -2533,8 +2508,6 @@ fn lint_parse(flags: &mut Flags, matches: &clap::ArgMatches) { } fn repl_parse(flags: &mut Flags, matches: &clap::ArgMatches) { - // Use no-check by default for the REPL - flags.type_check_mode = TypeCheckMode::None; runtime_args_parse(flags, matches, false, true); unsafely_ignore_certificate_errors_parse(flags, matches); @@ -2553,7 +2526,6 @@ fn repl_parse(flags: &mut Flags, matches: &clap::ArgMatches) { fn run_parse(flags: &mut Flags, matches: &clap::ArgMatches) { runtime_args_parse(flags, matches, true, true); - check_arg_parse(flags, matches); let mut script: Vec<String> = matches .values_of("script_arg") @@ -2629,6 +2601,7 @@ fn task_parse( } fn test_parse(flags: &mut Flags, matches: &clap::ArgMatches) { + flags.type_check_mode = TypeCheckMode::Local; runtime_args_parse(flags, matches, true, true); // NOTE: `deno test` always uses `--no-prompt`, tests shouldn't ever do // interactive prompts, unless done by user code @@ -2767,6 +2740,7 @@ fn compile_args_parse(flags: &mut Flags, matches: &clap::ArgMatches) { no_remote_arg_parse(flags, matches); config_args_parse(flags, matches); no_check_arg_parse(flags, matches); + check_arg_parse(flags, matches); reload_arg_parse(flags, matches); lock_args_parse(flags, matches); ca_file_arg_parse(flags, matches); @@ -2970,7 +2944,6 @@ fn compat_arg_parse(flags: &mut Flags, matches: &ArgMatches) { } fn no_check_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) { - flags.has_no_check_flag = matches.is_present("no-check"); if let Some(cache_type) = matches.value_of("no-check") { match cache_type { "remote" => flags.type_check_mode = TypeCheckMode::Local, @@ -2985,17 +2958,16 @@ fn no_check_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) { } fn check_arg_parse(flags: &mut Flags, matches: &clap::ArgMatches) { - flags.has_check_flag = matches.is_present("check"); if let Some(cache_type) = matches.value_of("check") { match cache_type { - "all" => flags.future_type_check_mode = FutureTypeCheckMode::All, + "all" => flags.type_check_mode = TypeCheckMode::All, _ => debug!( "invalid value for 'check' of '{}' using default", cache_type ), } } else if matches.is_present("check") { - flags.future_type_check_mode = FutureTypeCheckMode::Local; + flags.type_check_mode = TypeCheckMode::Local; } } @@ -3783,8 +3755,8 @@ mod tests { Flags { subcommand: DenoSubcommand::Check(CheckFlags { files: svec!["script.ts"], - remote: false, }), + type_check_mode: TypeCheckMode::Local, ..Flags::default() } ); @@ -3795,8 +3767,8 @@ mod tests { Flags { subcommand: DenoSubcommand::Check(CheckFlags { files: svec!["script.ts"], - remote: true, }), + type_check_mode: TypeCheckMode::All, ..Flags::default() } ); @@ -3980,7 +3952,6 @@ mod tests { import_map_path: Some("import_map.json".to_string()), no_remote: true, config_flag: ConfigFlag::Path("tsconfig.json".to_owned()), - has_no_check_flag: true, type_check_mode: TypeCheckMode::None, reload: true, lock: Some(PathBuf::from("lock.json")), @@ -4073,7 +4044,6 @@ mod tests { no_remote: true, config_flag: ConfigFlag::Path("tsconfig.json".to_owned()), type_check_mode: TypeCheckMode::None, - has_no_check_flag: true, reload: true, lock: Some(PathBuf::from("lock.json")), lock_write: true, @@ -4277,6 +4247,7 @@ mod tests { source_file: "source.ts".to_string(), out_file: None, }), + type_check_mode: TypeCheckMode::Local, ..Flags::default() } ); @@ -4302,6 +4273,7 @@ mod tests { }), allow_write: Some(vec![]), no_remote: true, + type_check_mode: TypeCheckMode::Local, config_flag: ConfigFlag::Path("tsconfig.json".to_owned()), ..Flags::default() } @@ -4318,6 +4290,7 @@ mod tests { source_file: "source.ts".to_string(), out_file: Some(PathBuf::from("bundle.js")), }), + type_check_mode: TypeCheckMode::Local, allow_write: Some(vec![]), ..Flags::default() } @@ -4340,6 +4313,7 @@ mod tests { source_file: "source.ts".to_string(), out_file: None, }), + type_check_mode: TypeCheckMode::Local, lock_write: true, lock: Some(PathBuf::from("lock.json")), ..Flags::default() @@ -4358,6 +4332,7 @@ mod tests { source_file: "source.ts".to_string(), out_file: None, }), + type_check_mode: TypeCheckMode::Local, ..Flags::default() } ); @@ -4374,7 +4349,6 @@ mod tests { source_file: "script.ts".to_string(), out_file: None, }), - has_no_check_flag: true, type_check_mode: TypeCheckMode::None, ..Flags::default() } @@ -4391,6 +4365,7 @@ mod tests { source_file: "source.ts".to_string(), out_file: None, }), + type_check_mode: TypeCheckMode::Local, watch: Some(vec![]), ..Flags::default() } @@ -4413,6 +4388,7 @@ mod tests { source_file: "source.ts".to_string(), out_file: None, }), + type_check_mode: TypeCheckMode::Local, watch: Some(vec![]), no_clear_screen: true, ..Flags::default() @@ -4597,7 +4573,6 @@ mod tests { import_map_path: Some("import_map.json".to_string()), no_remote: true, config_flag: ConfigFlag::Path("tsconfig.json".to_owned()), - has_no_check_flag: true, type_check_mode: TypeCheckMode::None, reload: true, lock: Some(PathBuf::from("lock.json")), @@ -4749,7 +4724,6 @@ mod tests { subcommand: DenoSubcommand::Run(RunFlags { script: "script.ts".to_string(), }), - has_no_check_flag: true, type_check_mode: TypeCheckMode::None, ..Flags::default() } @@ -4766,7 +4740,6 @@ mod tests { subcommand: DenoSubcommand::Run(RunFlags { script: "script.ts".to_string(), }), - has_no_check_flag: true, type_check_mode: TypeCheckMode::Local, ..Flags::default() } @@ -5020,6 +4993,7 @@ mod tests { no_prompt: true, coverage_dir: Some("cov".to_string()), location: Some(Url::parse("https://foo/").unwrap()), + type_check_mode: TypeCheckMode::Local, allow_net: Some(vec![]), argv: svec!["arg1", "arg2"], ..Flags::default() @@ -5086,6 +5060,7 @@ mod tests { concurrent_jobs: NonZeroUsize::new(4).unwrap(), trace_ops: false, }), + type_check_mode: TypeCheckMode::Local, no_prompt: true, ..Flags::default() } @@ -5113,6 +5088,7 @@ mod tests { concurrent_jobs: NonZeroUsize::new(1).unwrap(), trace_ops: false, }), + type_check_mode: TypeCheckMode::Local, no_prompt: true, ..Flags::default() } @@ -5145,6 +5121,7 @@ mod tests { trace_ops: false, }), no_prompt: true, + type_check_mode: TypeCheckMode::Local, enable_testing_features: true, ..Flags::default() } @@ -5171,6 +5148,7 @@ mod tests { }), no_prompt: true, watch: None, + type_check_mode: TypeCheckMode::Local, ..Flags::default() } ); @@ -5195,6 +5173,7 @@ mod tests { trace_ops: false, }), no_prompt: true, + type_check_mode: TypeCheckMode::Local, watch: Some(vec![]), ..Flags::default() } @@ -5221,6 +5200,7 @@ mod tests { trace_ops: false, }), watch: Some(vec![]), + type_check_mode: TypeCheckMode::Local, no_clear_screen: true, no_prompt: true, ..Flags::default() @@ -5244,6 +5224,7 @@ mod tests { source_file: "source.ts".to_string(), out_file: None, }), + type_check_mode: TypeCheckMode::Local, ca_file: Some("example.crt".to_owned()), ..Flags::default() } @@ -5424,6 +5405,7 @@ mod tests { args: vec![], target: None, }), + type_check_mode: TypeCheckMode::Local, ..Flags::default() } ); @@ -5445,7 +5427,6 @@ mod tests { import_map_path: Some("import_map.json".to_string()), no_remote: true, config_flag: ConfigFlag::Path("tsconfig.json".to_owned()), - has_no_check_flag: true, type_check_mode: TypeCheckMode::None, reload: true, lock: Some(PathBuf::from("lock.json")), @@ -5829,6 +5810,7 @@ mod tests { ignore: vec![], }), unstable: true, + type_check_mode: TypeCheckMode::Local, location: Some(Url::parse("https://foo/").unwrap()), allow_net: Some(vec![]), no_prompt: true, @@ -5847,8 +5829,7 @@ mod tests { subcommand: DenoSubcommand::Run(RunFlags { script: "script.ts".to_string(), }), - has_check_flag: true, - future_type_check_mode: FutureTypeCheckMode::Local, + type_check_mode: TypeCheckMode::Local, ..Flags::default() } ); @@ -5860,8 +5841,7 @@ mod tests { subcommand: DenoSubcommand::Run(RunFlags { script: "script.ts".to_string(), }), - has_check_flag: true, - future_type_check_mode: FutureTypeCheckMode::All, + type_check_mode: TypeCheckMode::All, ..Flags::default() } ); @@ -5873,8 +5853,7 @@ mod tests { subcommand: DenoSubcommand::Run(RunFlags { script: "script.ts".to_string(), }), - has_check_flag: true, - future_type_check_mode: FutureTypeCheckMode::Local, + type_check_mode: TypeCheckMode::None, ..Flags::default() } ); diff --git a/cli/main.rs b/cli/main.rs index 93846497d..25f472854 100644 --- a/cli/main.rs +++ b/cli/main.rs @@ -51,7 +51,6 @@ use crate::flags::DocFlags; use crate::flags::EvalFlags; use crate::flags::Flags; use crate::flags::FmtFlags; -use crate::flags::FutureTypeCheckMode; use crate::flags::InfoFlags; use crate::flags::InstallFlags; use crate::flags::LintFlags; @@ -586,18 +585,6 @@ async fn check_command( flags: Flags, check_flags: CheckFlags, ) -> Result<i32, AnyError> { - // NOTE(bartlomieju): currently just an alias for `deno cache`, but - // it will be changed in Deno 2.0. - let mut flags = flags.clone(); - - // In `deno check` the default mode is to check only - // local modules, with `--remote` we check remote modules too. - flags.type_check_mode = if check_flags.remote { - TypeCheckMode::All - } else { - TypeCheckMode::Local - }; - cache_command( flags, CacheFlags { @@ -1430,7 +1417,7 @@ pub fn main() { // TODO(bartlomieju): doesn't handle exit code set by the runtime properly unwrap_or_exit(standalone_res); - let mut flags = match flags::flags_from_vec(args) { + let flags = match flags::flags_from_vec(args) { Ok(flags) => flags, Err(err @ clap::Error { .. }) if err.kind() == clap::ErrorKind::DisplayHelp @@ -1447,26 +1434,6 @@ pub fn main() { logger::init(flags.log_level); - // TODO(bartlomieju): v1.22 is a "pivot version" in terms of default - // type checking mode. We're opting into type checking only local - // files by default and in v1.23 we're not gonna type check at all by default. - // So right now, we're still allowing to use `--no-check` flag and if it is - // present, we opt into the "old" behavior. Additionally, if - // "DENO_FUTURE_CHECK" env var is present we're switching to the new behavior - // of skipping type checking completely if no `--check` flag is present. - let future_check_env_var = env::var("DENO_FUTURE_CHECK").ok(); - if let Some(env_var) = future_check_env_var { - if env_var == "1" && !flags.has_check_flag { - flags.type_check_mode = TypeCheckMode::None; - } - } else if !flags.has_no_check_flag { - flags.type_check_mode = match &flags.future_type_check_mode { - FutureTypeCheckMode::None => TypeCheckMode::None, - FutureTypeCheckMode::All => TypeCheckMode::All, - FutureTypeCheckMode::Local => TypeCheckMode::Local, - } - } - let exit_code = get_subcommand(flags).await; exit_code diff --git a/cli/tests/integration/bundle_tests.rs b/cli/tests/integration/bundle_tests.rs index 9c328abdb..4bd342acd 100644 --- a/cli/tests/integration/bundle_tests.rs +++ b/cli/tests/integration/bundle_tests.rs @@ -34,7 +34,6 @@ fn bundle_exports() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&test) .output() @@ -77,7 +76,6 @@ fn bundle_exports_no_check() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&test) .output() @@ -110,7 +108,6 @@ fn bundle_circular() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&bundle) .output() @@ -143,7 +140,6 @@ fn bundle_single_module() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&bundle) .output() @@ -186,7 +182,6 @@ fn bundle_tla() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&test) .output() @@ -219,7 +214,6 @@ fn bundle_js() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&bundle) .output() @@ -294,7 +288,6 @@ fn bundle_import_map() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg(&test) @@ -340,7 +333,6 @@ fn bundle_import_map_no_check() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&test) .output() @@ -373,7 +365,6 @@ fn bundle_json_module() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&bundle) .output() @@ -406,7 +397,6 @@ fn bundle_json_module_escape_sub() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&bundle) .output() diff --git a/cli/tests/integration/cache_tests.rs b/cli/tests/integration/cache_tests.rs index bf0233a28..aaae62531 100644 --- a/cli/tests/integration/cache_tests.rs +++ b/cli/tests/integration/cache_tests.rs @@ -9,7 +9,7 @@ itest!(_036_import_map_fetch { }); itest!(_037_fetch_multiple { - args: "cache --reload fetch/test.ts fetch/other.ts", + args: "cache --reload --check=all fetch/test.ts fetch/other.ts", http_server: true, output: "037_fetch_multiple.out", }); @@ -21,25 +21,27 @@ itest!(_095_cache_with_bare_import { }); itest!(cache_extensionless { - args: "cache --reload http://localhost:4545/subdir/no_js_ext", + args: "cache --reload --check=all http://localhost:4545/subdir/no_js_ext", output: "cache_extensionless.out", http_server: true, }); itest!(cache_random_extension { - args: "cache --reload http://localhost:4545/subdir/no_js_ext@1.0.0", + args: + "cache --reload --check=all http://localhost:4545/subdir/no_js_ext@1.0.0", output: "cache_random_extension.out", http_server: true, }); itest!(performance_stats { - args: "cache --reload --log-level debug 002_hello.ts", + args: "cache --reload --check=all --log-level debug 002_hello.ts", output: "performance_stats.out", }); itest!(redirect_cache { http_server: true, - args: "cache --reload http://localhost:4548/subdir/redirects/a.ts", + args: + "cache --reload --check=all http://localhost:4548/subdir/redirects/a.ts", output: "redirect_cache.out", }); @@ -89,5 +91,4 @@ itest!(check_local_by_default2 { args: "cache --quiet cache/check_local_by_default2.ts", output: "cache/check_local_by_default2.out", http_server: true, - exit_code: 1, }); diff --git a/cli/tests/integration/eval_tests.rs b/cli/tests/integration/eval_tests.rs index a93f85286..892ca7ffd 100644 --- a/cli/tests/integration/eval_tests.rs +++ b/cli/tests/integration/eval_tests.rs @@ -77,5 +77,4 @@ itest!(check_local_by_default2 { args: "eval --quiet import('./eval/check_local_by_default2.ts').then(console.log);", output: "eval/check_local_by_default2.out", http_server: true, - exit_code: 1, }); diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs index 86a5d4264..f60e870c6 100644 --- a/cli/tests/integration/inspector_tests.rs +++ b/cli/tests/integration/inspector_tests.rs @@ -142,7 +142,6 @@ async fn assert_inspector_messages( async fn inspector_connect() { let script = util::testdata_path().join("inspector/inspector1.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) .arg(script) @@ -168,7 +167,6 @@ async fn inspector_connect() { async fn inspector_break_on_first_line() { let script = util::testdata_path().join("inspector/inspector2.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect-brk")) .arg(script) @@ -259,7 +257,6 @@ async fn inspector_break_on_first_line() { async fn inspector_pause() { let script = util::testdata_path().join("inspector/inspector1.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) .arg(script) @@ -330,7 +327,6 @@ async fn inspector_port_collision() { let inspect_flag = inspect_flag_with_unique_port("--inspect"); let mut child1 = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&inspect_flag) .arg(script.clone()) @@ -345,7 +341,6 @@ async fn inspector_port_collision() { let _ = extract_ws_url_from_stderr(&mut stderr_1_lines); let mut child2 = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(&inspect_flag) .arg(script) @@ -370,7 +365,6 @@ async fn inspector_port_collision() { async fn inspector_does_not_hang() { let script = util::testdata_path().join("inspector/inspector3.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect-brk")) .env("NO_COLOR", "1") @@ -482,7 +476,6 @@ async fn inspector_does_not_hang() { async fn inspector_without_brk_runs_code() { let script = util::testdata_path().join("inspector/inspector4.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) .arg(script) @@ -610,7 +603,6 @@ async fn inspector_runtime_evaluate_does_not_crash() { async fn inspector_json() { let script = util::testdata_path().join("inspector/inspector1.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) .arg(script) @@ -640,7 +632,6 @@ async fn inspector_json() { async fn inspector_json_list() { let script = util::testdata_path().join("inspector/inspector1.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) .arg(script) @@ -672,7 +663,6 @@ async fn inspector_connect_non_ws() { // Verify we don't panic if non-WS connection is being established let script = util::testdata_path().join("inspector/inspector1.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect")) .arg(script) @@ -698,7 +688,6 @@ async fn inspector_connect_non_ws() { async fn inspector_break_on_first_line_in_test() { let script = util::testdata_path().join("inspector/inspector_test.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("test") .arg(inspect_flag_with_unique_port("--inspect-brk")) .arg(script) @@ -793,7 +782,6 @@ async fn inspector_break_on_first_line_in_test() { async fn inspector_with_ts_files() { let script = util::testdata_path().join("inspector/test.ts"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg(inspect_flag_with_unique_port("--inspect-brk")) @@ -920,7 +908,6 @@ async fn inspector_with_ts_files() { async fn inspector_memory() { let script = util::testdata_path().join("inspector/memory.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect-brk")) .arg(script) @@ -1035,7 +1022,6 @@ async fn inspector_memory() { async fn inspector_profile() { let script = util::testdata_path().join("inspector/memory.js"); let mut child = util::deno_cmd() - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg(inspect_flag_with_unique_port("--inspect-brk")) .arg(script) diff --git a/cli/tests/integration/install_tests.rs b/cli/tests/integration/install_tests.rs index 44b418e10..60bfaf50e 100644 --- a/cli/tests/integration/install_tests.rs +++ b/cli/tests/integration/install_tests.rs @@ -14,6 +14,7 @@ fn install_basic() { let status = util::deno_cmd() .current_dir(temp_dir.path()) .arg("install") + .arg("--check") .arg("--name") .arg("echo_test") .arg("http://localhost:4545/echo.ts") @@ -58,6 +59,7 @@ fn install_custom_dir_env_var() { let status = util::deno_cmd() .current_dir(util::root_path()) // different cwd .arg("install") + .arg("--check") .arg("--name") .arg("echo_test") .arg("http://localhost:4545/echo.ts") @@ -188,7 +190,7 @@ fn check_local_by_default2() { let temp_dir = TempDir::new(); let temp_dir_str = temp_dir.path().to_string_lossy().to_string(); - let output = util::deno_cmd() + let status = util::deno_cmd() .current_dir(temp_dir.path()) .arg("install") .arg(util::testdata_path().join("./install/check_local_by_default2.ts")) @@ -198,13 +200,7 @@ fn check_local_by_default2() { ("USERPROFILE", temp_dir_str.as_str()), ("DENO_INSTALL_ROOT", ""), ]) - .output() + .status() .unwrap(); - assert!(!output.status.success()); - let stdout = String::from_utf8(output.stdout).unwrap(); - let stderr = String::from_utf8(output.stderr).unwrap(); - assert!(stdout.is_empty()); - assert!(stderr.contains( - r#"error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'."# - )); + assert!(status.success()); } diff --git a/cli/tests/integration/mod.rs b/cli/tests/integration/mod.rs index d0c693a37..42ae24142 100644 --- a/cli/tests/integration/mod.rs +++ b/cli/tests/integration/mod.rs @@ -150,6 +150,7 @@ fn cache_test() { .env("DENO_DIR", deno_dir.path()) .current_dir(util::testdata_path()) .arg("cache") + .arg("--check=all") .arg("-L") .arg("debug") .arg(module_url.to_string()) @@ -297,7 +298,6 @@ fn ts_dependency_recompilation() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg(&ats) @@ -321,7 +321,6 @@ fn ts_dependency_recompilation() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg(&ats) @@ -346,7 +345,6 @@ fn ts_no_recheck_on_redirect() { assert!(redirect_ts.is_file()); let mut cmd = Command::new(e.clone()); cmd.env("DENO_DIR", deno_dir.path()); - cmd.env("DENO_FUTURE_CHECK", "1"); let mut initial = cmd .current_dir(util::testdata_path()) .arg("run") @@ -360,7 +358,6 @@ fn ts_no_recheck_on_redirect() { let mut cmd = Command::new(e); cmd.env("DENO_DIR", deno_dir.path()); - cmd.env("DENO_FUTURE_CHECK", "1"); let output = cmd .current_dir(util::testdata_path()) .arg("run") @@ -381,6 +378,7 @@ fn ts_reload() { let mut initial = util::deno_cmd_with_deno_dir(&deno_dir) .current_dir(util::testdata_path()) .arg("cache") + .arg("--check=all") .arg(&hello_ts) .spawn() .expect("failed to spawn script"); @@ -391,6 +389,7 @@ fn ts_reload() { let output = util::deno_cmd_with_deno_dir(&deno_dir) .current_dir(util::testdata_path()) .arg("cache") + .arg("--check=all") .arg("--reload") .arg("-L") .arg("debug") @@ -654,7 +653,6 @@ fn cafile_bundle_remote_exports() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg(&test) @@ -867,7 +865,6 @@ async fn test_resolve_dns() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg("--allow-net") @@ -895,7 +892,6 @@ async fn test_resolve_dns() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg("--allow-net=127.0.0.1:4553") @@ -922,7 +918,6 @@ async fn test_resolve_dns() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg("--allow-net=deno.land") @@ -946,7 +941,6 @@ async fn test_resolve_dns() { let output = util::deno_cmd() .current_dir(util::testdata_path()) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("--check") .arg("resolve_dns.ts") diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index f5929ee55..7ea95c312 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -13,7 +13,6 @@ itest!(stdout_write_all { itest!(_001_hello { args: "run --reload 001_hello.js", output: "001_hello.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(_002_hello { @@ -107,7 +106,6 @@ itest!(_021_mjs_modules { itest!(_023_no_ext { args: "run --reload --check 023_no_ext", output: "023_no_ext.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); // TODO(lucacasonato): remove --unstable when permissions goes stable @@ -161,12 +159,11 @@ itest!(_035_cached_only_flag { output: "035_cached_only_flag.out", exit_code: 1, http_server: true, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(_038_checkjs { // checking if JS file is run through TS compiler - args: "run --reload --config checkjs.tsconfig.json 038_checkjs.js", + args: "run --reload --config checkjs.tsconfig.json --check 038_checkjs.js", exit_code: 1, output: "038_checkjs.js.out", }); @@ -211,7 +208,6 @@ itest!(_052_no_remote_flag { output: "052_no_remote_flag.out", exit_code: 1, http_server: true, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(_056_make_temp_file_write_perm { @@ -532,7 +528,7 @@ fn _090_run_permissions_request() { } itest!(_091_use_define_for_class_fields { - args: "run 091_use_define_for_class_fields.ts", + args: "run --check 091_use_define_for_class_fields.ts", output: "091_use_define_for_class_fields.ts.out", exit_code: 1, }); @@ -553,7 +549,6 @@ itest!(blob_gc_finalization { args: "run blob_gc_finalization.js", output: "blob_gc_finalization.js.out", exit_code: 0, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(fetch_response_finalization { @@ -561,7 +556,6 @@ itest!(fetch_response_finalization { output: "fetch_response_finalization.js.out", http_server: true, exit_code: 0, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(import_type { @@ -650,7 +644,7 @@ itest!(async_error { }); itest!(config { - args: "run --reload --config config.tsconfig.json config.ts", + args: "run --reload --config config.tsconfig.json --check config.ts", exit_code: 1, output: "config.ts.out", }); @@ -670,7 +664,6 @@ itest!(config_types_remote { itest!(empty_typescript { args: "run --reload --check subdir/empty.ts", output_str: Some("Check file:[WILDCARD]/subdir/empty.ts\n"), - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(error_001 { @@ -686,7 +679,7 @@ itest!(error_002 { }); itest!(error_003_typescript { - args: "run --reload error_003_typescript.ts", + args: "run --reload --check error_003_typescript.ts", exit_code: 1, output: "error_003_typescript.ts.out", }); @@ -696,7 +689,7 @@ itest!(error_003_typescript { // should result in the same output. // https://github.com/denoland/deno/issues/2436 itest!(error_003_typescript2 { - args: "run error_003_typescript.ts", + args: "run --check error_003_typescript.ts", exit_code: 1, output: "error_003_typescript.ts.out", }); @@ -747,20 +740,17 @@ itest!(error_012_bad_dynamic_import_specifier { args: "run --reload --check error_012_bad_dynamic_import_specifier.ts", exit_code: 1, output: "error_012_bad_dynamic_import_specifier.ts.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(error_013_missing_script { args: "run --reload missing_file_name", exit_code: 1, output: "error_013_missing_script.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(error_014_catch_dynamic_import_error { args: "run --reload --allow-read error_014_catch_dynamic_import_error.js", output: "error_014_catch_dynamic_import_error.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(error_015_dynamic_import_permissions { @@ -779,7 +769,7 @@ itest!(error_016_dynamic_import_permissions2 { }); itest!(error_017_hide_long_source_ts { - args: "run --reload error_017_hide_long_source_ts.ts", + args: "run --reload --check error_017_hide_long_source_ts.ts", output: "error_017_hide_long_source_ts.ts.out", exit_code: 1, }); @@ -788,7 +778,6 @@ itest!(error_018_hide_long_source_js { args: "run error_018_hide_long_source_js.js", output: "error_018_hide_long_source_js.js.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(error_019_stack_function { @@ -841,7 +830,7 @@ itest!(error_026_remote_import_error { }); itest!(error_for_await { - args: "run --reload error_for_await.ts", + args: "run --reload --check error_for_await.ts", output: "error_for_await.ts.out", exit_code: 1, }); @@ -862,18 +851,16 @@ itest!(error_syntax { args: "run --reload error_syntax.js", exit_code: 1, output: "error_syntax.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(error_syntax_empty_trailing_line { args: "run --reload error_syntax_empty_trailing_line.mjs", exit_code: 1, output: "error_syntax_empty_trailing_line.mjs.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(error_type_definitions { - args: "run --reload error_type_definitions.ts", + args: "run --reload --check error_type_definitions.ts", exit_code: 1, output: "error_type_definitions.ts.out", }); @@ -992,7 +979,6 @@ itest!(runtime_decorators { itest!(seed_random { args: "run --seed=100 seed_random.js", output: "seed_random.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(type_definitions { @@ -1004,17 +990,16 @@ itest!(type_definitions_for_export { args: "run --reload --check type_definitions_for_export.ts", output: "type_definitions_for_export.ts.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(type_directives_01 { - args: "run --reload -L debug type_directives_01.ts", + args: "run --reload --check=all -L debug type_directives_01.ts", output: "type_directives_01.ts.out", http_server: true, }); itest!(type_directives_02 { - args: "run --reload -L debug type_directives_02.ts", + args: "run --reload --check=all -L debug type_directives_02.ts", output: "type_directives_02.ts.out", }); @@ -1028,40 +1013,34 @@ itest!(type_directives_redirect { args: "run --reload --check type_directives_redirect.ts", output: "type_directives_redirect.ts.out", http_server: true, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(type_headers_deno_types { args: "run --reload --check type_headers_deno_types.ts", output: "type_headers_deno_types.ts.out", http_server: true, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(ts_type_imports { args: "run --reload --check ts_type_imports.ts", output: "ts_type_imports.ts.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(ts_decorators { args: "run --reload -c tsconfig.decorators.json --check ts_decorators.ts", output: "ts_decorators.ts.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(ts_type_only_import { args: "run --reload --check ts_type_only_import.ts", output: "ts_type_only_import.ts.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(swc_syntax_error { args: "run --reload --check swc_syntax_error.ts", output: "swc_syntax_error.ts.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unbuffered_stderr { @@ -1077,7 +1056,6 @@ itest!(unbuffered_stdout { itest!(v8_flags_run { args: "run --v8-flags=--expose-gc v8_flags.js", output: "v8_flags.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(v8_flags_unrecognized { @@ -1110,14 +1088,12 @@ itest!(wasm_shared { itest!(wasm_async { args: "run wasm_async.js", output: "wasm_async.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(wasm_unreachable { args: "run --allow-read wasm_unreachable.js", output: "wasm_unreachable.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(wasm_url { @@ -1135,40 +1111,34 @@ itest!(weakref { itest!(top_level_await_order { args: "run --allow-read top_level_await_order.js", output: "top_level_await_order.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(top_level_await_loop { args: "run --allow-read top_level_await_loop.js", output: "top_level_await_loop.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(top_level_await_circular { args: "run --allow-read top_level_await_circular.js", output: "top_level_await_circular.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); // Regression test for https://github.com/denoland/deno/issues/11238. itest!(top_level_await_nested { args: "run --allow-read top_level_await_nested/main.js", output: "top_level_await_nested.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(top_level_await_unresolved { args: "run top_level_await_unresolved.js", output: "top_level_await_unresolved.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(top_level_await { args: "run --allow-read top_level_await.js", output: "top_level_await.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(top_level_await_ts { @@ -1187,7 +1157,7 @@ itest!(top_level_for_await_ts { }); itest!(unstable_disabled { - args: "run --reload unstable.ts", + args: "run --reload --check unstable.ts", exit_code: 1, output: "unstable_disabled.out", }); @@ -1200,7 +1170,6 @@ itest!(unstable_enabled { itest!(unstable_disabled_js { args: "run --reload unstable.js", output: "unstable_disabled_js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_enabled_js { @@ -1241,13 +1210,11 @@ itest!(dynamic_import_conditional { itest!(tsx_imports { args: "run --reload --check tsx_imports.ts", output: "tsx_imports.ts.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(fix_dynamic_import_errors { args: "run --reload fix_dynamic_import_errors.js", output: "fix_dynamic_import_errors.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(fix_emittable_skipped { @@ -1422,7 +1389,6 @@ itest!(jsx_import_source_import_map_no_check { itest!(proto_exploit { args: "run proto_exploit.js", output: "proto_exploit.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(reference_types { @@ -1519,7 +1485,6 @@ itest!(classic_workers_event_loop { args: "run --enable-testing-features-do-not-use classic_workers_event_loop.js", output: "classic_workers_event_loop.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); // FIXME(bartlomieju): disabled, because this test is very flaky on CI @@ -1571,7 +1536,6 @@ itest!(error_import_map_unable_to_load { args: "run --import-map=import_maps/does_not_exist.json import_maps/test.ts", output: "error_import_map_unable_to_load.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); // Test that setting `self` in the main thread to some other value doesn't break @@ -1579,7 +1543,6 @@ itest!(error_import_map_unable_to_load { itest!(replace_self { args: "run replace_self.js", output: "replace_self.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(worker_event_handler_test { @@ -1622,7 +1585,6 @@ itest!(reference_types_error { args: "run --config checkjs.tsconfig.json --check reference_types_error.js", output: "reference_types_error.js.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(reference_types_error_no_check { @@ -1634,7 +1596,6 @@ itest!(jsx_import_source_error { args: "run --config jsx/deno-jsx-error.jsonc --check jsx_import_source_no_pragma.tsx", output: "jsx_import_source_error.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(shebang_tsc { @@ -1663,7 +1624,6 @@ itest!(shebang_with_json_imports_swc { fn no_validate_asm() { let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("no_validate_asm.js") .stderr(std::process::Stdio::piped()) @@ -1808,7 +1768,6 @@ fn rust_log() { // Without RUST_LOG the stderr is empty. let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("001_hello.js") .stderr(std::process::Stdio::piped()) @@ -1822,7 +1781,6 @@ fn rust_log() { // With RUST_LOG the stderr is not empty. let output = util::deno_cmd() .current_dir(util::testdata_path()) - .env("DENO_FUTURE_CHECK", "1") .arg("run") .arg("001_hello.js") .env("RUST_LOG", "debug") @@ -1843,6 +1801,7 @@ fn dont_cache_on_check_fail() { let output = deno_cmd .current_dir(util::testdata_path()) .arg("run") + .arg("--check=all") .arg("--reload") .arg("error_003_typescript.ts") .stderr(std::process::Stdio::piped()) @@ -1857,6 +1816,7 @@ fn dont_cache_on_check_fail() { let output = deno_cmd .current_dir(util::testdata_path()) .arg("run") + .arg("--check=all") .arg("error_003_typescript.ts") .stderr(std::process::Stdio::piped()) .spawn() @@ -2400,7 +2360,6 @@ itest!(eval_context_throw_with_conflicting_source { itest!(eval_context_throw_dom_exception { args: "run eval_context_throw_dom_exception.js", output: "eval_context_throw_dom_exception.js.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); /// Regression test for https://github.com/denoland/deno/issues/12740. @@ -2450,6 +2409,7 @@ fn issue12807() { let status = deno_cmd .current_dir(util::testdata_path()) .arg("run") + .arg("--check") .arg(&mod1_path) .stderr(std::process::Stdio::null()) .stdout(std::process::Stdio::null()) @@ -2463,6 +2423,7 @@ fn issue12807() { let status = deno_cmd .current_dir(util::testdata_path()) .arg("run") + .arg("--check") .arg(&mod1_path) .stderr(std::process::Stdio::null()) .stdout(std::process::Stdio::null()) @@ -2506,7 +2467,7 @@ itest!(import_assertions_dynamic_error { }); itest!(import_assertions_type_check { - args: "run --allow-read import_assertions/type_check.ts", + args: "run --allow-read --check import_assertions/type_check.ts", output: "import_assertions/type_check.out", exit_code: 1, }); @@ -2514,13 +2475,11 @@ itest!(import_assertions_type_check { itest!(delete_window { args: "run delete_window.js", output_str: Some("true\n"), - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(colors_without_global_this { args: "run colors_without_globalThis.js", output_str: Some("true\n"), - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(config_auto_discovered_for_local_script { @@ -2529,7 +2488,7 @@ itest!(config_auto_discovered_for_local_script { }); itest!(no_config_auto_discovery_for_local_script { - args: "run --quiet --no-config run/with_config/frontend_work.ts", + args: "run --quiet --no-config --check run/with_config/frontend_work.ts", output: "run/with_config/no_auto_discovery.out", exit_code: 1, }); @@ -2544,7 +2503,6 @@ itest!(wasm_streaming_panic_test { args: "run wasm_streaming_panic_test.js", output: "wasm_streaming_panic_test.js.out", exit_code: 1, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); // Regression test for https://github.com/denoland/deno/issues/13897. @@ -2558,116 +2516,95 @@ itest!(unstable_ffi_1 { args: "run unstable_ffi_1.js", output: "unstable_ffi_1.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_2 { args: "run unstable_ffi_2.js", output: "unstable_ffi_2.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_3 { args: "run unstable_ffi_3.js", output: "unstable_ffi_3.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_4 { args: "run unstable_ffi_4.js", output: "unstable_ffi_4.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_5 { args: "run unstable_ffi_5.js", output: "unstable_ffi_5.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_6 { args: "run unstable_ffi_6.js", output: "unstable_ffi_6.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_7 { args: "run unstable_ffi_7.js", output: "unstable_ffi_7.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_8 { args: "run unstable_ffi_8.js", output: "unstable_ffi_8.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_9 { args: "run unstable_ffi_9.js", output: "unstable_ffi_9.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_10 { args: "run unstable_ffi_10.js", output: "unstable_ffi_10.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_11 { args: "run unstable_ffi_11.js", output: "unstable_ffi_11.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_12 { args: "run unstable_ffi_12.js", output: "unstable_ffi_12.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_13 { args: "run unstable_ffi_13.js", output: "unstable_ffi_13.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_14 { args: "run unstable_ffi_14.js", output: "unstable_ffi_14.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(unstable_ffi_15 { args: "run unstable_ffi_15.js", output: "unstable_ffi_15.js.out", exit_code: 70, - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], -}); - -itest!(future_check1 { - args: "run future_check.ts", - output: "future_check1.out", }); itest!(future_check2 { args: "run --check future_check.ts", output: "future_check2.out", - envs: vec![("DENO_FUTURE_CHECK".to_string(), "1".to_string())], }); itest!(event_listener_error { @@ -2721,7 +2658,7 @@ itest!(complex_error { // Regression test for https://github.com/denoland/deno/issues/12143. itest!(js_root_with_ts_check { - args: "run --quiet js_root_with_ts_check.js", + args: "run --quiet --check js_root_with_ts_check.js", output: "js_root_with_ts_check.js.out", exit_code: 1, }); diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs index ec2588911..cff0e8f44 100644 --- a/cli/tests/integration/watcher_tests.rs +++ b/cli/tests/integration/watcher_tests.rs @@ -666,7 +666,6 @@ fn run_watch_load_unload_events() { .arg("debug") .arg(&file_to_watch) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() @@ -725,7 +724,6 @@ fn run_watch_not_exit() { .arg("debug") .arg(&file_to_watch) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() @@ -785,7 +783,6 @@ fn run_watch_with_import_map_and_relative_paths() { .arg(&import_map_path) .arg(&file_to_watch) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() @@ -1008,7 +1005,6 @@ fn test_watch_module_graph_error_referrer() { .arg("--unstable") .arg(&file_to_watch) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() @@ -1066,7 +1062,6 @@ fn run_watch_dynamic_imports() { .arg("debug") .arg(&file_to_watch) .env("NO_COLOR", "1") - .env("DENO_FUTURE_CHECK", "1") .stdout(std::process::Stdio::piped()) .stderr(std::process::Stdio::piped()) .spawn() diff --git a/cli/tests/testdata/cache/check_local_by_default2.out b/cli/tests/testdata/cache/check_local_by_default2.out index 1367dc70e..e69de29bb 100644 --- a/cli/tests/testdata/cache/check_local_by_default2.out +++ b/cli/tests/testdata/cache/check_local_by_default2.out @@ -1,4 +0,0 @@ -error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'. -const b: "b" = 12; - ^ - at [WILDCARD]cache/check_local_by_default2.ts:3:7 diff --git a/cli/tests/testdata/eval/check_local_by_default2.out b/cli/tests/testdata/eval/check_local_by_default2.out index 072068827..086d4bb34 100644 --- a/cli/tests/testdata/eval/check_local_by_default2.out +++ b/cli/tests/testdata/eval/check_local_by_default2.out @@ -1,4 +1,3 @@ -error: TS2322 [ERROR]: Type '12' is not assignable to type '"b"'. -const b: "b" = 12; - ^ - at [WILDCARD]eval/check_local_by_default2.ts:3:7 +12 +12 +Module {} diff --git a/cli/tests/testdata/future_check1.out b/cli/tests/testdata/future_check1.out deleted file mode 100644 index c626a5485..000000000 --- a/cli/tests/testdata/future_check1.out +++ /dev/null @@ -1 +0,0 @@ -Check [WILDCARD]/future_check.ts diff --git a/cli/tools/installer.rs b/cli/tools/installer.rs index bf39abc65..962f16ce3 100644 --- a/cli/tools/installer.rs +++ b/cli/tools/installer.rs @@ -513,12 +513,11 @@ mod tests { println!("this is the file path {:?}", content); if cfg!(windows) { assert!(content.contains( - r#""run" "--check" "--unstable" "http://localhost:4545/echo_server.ts""# + r#""run" "--unstable" "http://localhost:4545/echo_server.ts""# )); } else { - assert!(content.contains( - r#"run --check --unstable 'http://localhost:4545/echo_server.ts'"# - )); + assert!(content + .contains(r#"run --unstable 'http://localhost:4545/echo_server.ts'"#)); } } @@ -539,7 +538,7 @@ mod tests { assert_eq!(shim_data.name, "echo_server"); assert_eq!( shim_data.args, - vec!["run", "--check", "http://localhost:4545/echo_server.ts",] + vec!["run", "http://localhost:4545/echo_server.ts",] ); } @@ -560,7 +559,7 @@ mod tests { assert_eq!(shim_data.name, "subdir"); assert_eq!( shim_data.args, - vec!["run", "--check", "http://localhost:4545/subdir/main.ts",] + vec!["run", "http://localhost:4545/subdir/main.ts",] ); } @@ -581,7 +580,7 @@ mod tests { assert_eq!(shim_data.name, "echo_test"); assert_eq!( shim_data.args, - vec!["run", "--check", "http://localhost:4545/echo_server.ts",] + vec!["run", "http://localhost:4545/echo_server.ts",] ); } @@ -640,12 +639,7 @@ mod tests { assert_eq!( shim_data.args, - vec![ - "run", - "--check", - "--no-prompt", - "http://localhost:4545/echo_server.ts", - ] + vec!["run", "--no-prompt", "http://localhost:4545/echo_server.ts",] ); } @@ -668,12 +662,7 @@ mod tests { assert_eq!( shim_data.args, - vec![ - "run", - "--allow-all", - "--check", - "http://localhost:4545/echo_server.ts", - ] + vec!["run", "--allow-all", "http://localhost:4545/echo_server.ts",] ); } @@ -836,8 +825,9 @@ mod tests { if cfg!(windows) { // TODO: see comment above this test } else { - assert!(content - .contains(r#"run --check 'http://localhost:4545/echo_server.ts' '"'"#)); + assert!( + content.contains(r#"run 'http://localhost:4545/echo_server.ts' '"'"#) + ); } } @@ -956,10 +946,9 @@ mod tests { } assert!(file_path.exists()); - let mut expected_string = format!("run --check '{}'", &file_module_string); + let mut expected_string = format!("run '{}'", &file_module_string); if cfg!(windows) { - expected_string = - format!("\"run\" \"--check\" \"{}\"", &file_module_string); + expected_string = format!("\"run\" \"{}\"", &file_module_string); } let content = fs::read_to_string(file_path).unwrap(); diff --git a/cli/tools/standalone.rs b/cli/tools/standalone.rs index 3a8faa8a3..e29545b2f 100644 --- a/cli/tools/standalone.rs +++ b/cli/tools/standalone.rs @@ -4,7 +4,6 @@ use crate::deno_dir::DenoDir; use crate::flags::CompileFlags; use crate::flags::DenoSubcommand; use crate::flags::Flags; -use crate::flags::FutureTypeCheckMode; use crate::flags::RunFlags; use crate::flags::TypeCheckMode; use crate::fs_util; @@ -275,10 +274,7 @@ pub fn compile_to_runtime_flags( lock_write: false, lock: None, log_level: flags.log_level, - has_no_check_flag: false, - has_check_flag: false, type_check_mode: TypeCheckMode::Local, - future_type_check_mode: FutureTypeCheckMode::None, compat: flags.compat, unsafely_ignore_certificate_errors: flags .unsafely_ignore_certificate_errors |