summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/bundle_tests.rs13
-rw-r--r--cli/tests/integration/check_tests.rs34
-rw-r--r--cli/tests/integration/inspector_tests.rs15
-rw-r--r--cli/tests/integration/mod.rs20
-rw-r--r--cli/tests/integration/run_tests.rs104
-rw-r--r--cli/tests/integration/watcher_tests.rs5
-rw-r--r--cli/tests/testdata/check_all.out4
-rw-r--r--cli/tests/testdata/check_all.ts3
-rw-r--r--cli/tests/testdata/future_check.ts1
-rw-r--r--cli/tests/testdata/future_check1.out3
-rw-r--r--cli/tests/testdata/future_check2.out1
11 files changed, 185 insertions, 18 deletions
diff --git a/cli/tests/integration/bundle_tests.rs b/cli/tests/integration/bundle_tests.rs
index bb2489e03..e1a75f18d 100644
--- a/cli/tests/integration/bundle_tests.rs
+++ b/cli/tests/integration/bundle_tests.rs
@@ -34,6 +34,7 @@ fn bundle_exports() {
let output = util::deno_cmd()
.current_dir(util::testdata_path())
+ .env("DENO_FUTURE_CHECK", "1")
.arg("run")
.arg(&test)
.output()
@@ -56,7 +57,6 @@ fn bundle_exports_no_check() {
let mut deno = util::deno_cmd()
.current_dir(util::testdata_path())
.arg("bundle")
- .arg("--no-check")
.arg(mod1)
.arg(&bundle)
.spawn()
@@ -77,6 +77,7 @@ 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()
@@ -109,6 +110,7 @@ fn bundle_circular() {
let output = util::deno_cmd()
.current_dir(util::testdata_path())
+ .env("DENO_FUTURE_CHECK", "1")
.arg("run")
.arg(&bundle)
.output()
@@ -141,6 +143,7 @@ fn bundle_single_module() {
let output = util::deno_cmd()
.current_dir(util::testdata_path())
+ .env("DENO_FUTURE_CHECK", "1")
.arg("run")
.arg(&bundle)
.output()
@@ -183,6 +186,7 @@ fn bundle_tla() {
let output = util::deno_cmd()
.current_dir(util::testdata_path())
+ .env("DENO_FUTURE_CHECK", "1")
.arg("run")
.arg(&test)
.output()
@@ -215,6 +219,7 @@ fn bundle_js() {
let output = util::deno_cmd()
.current_dir(util::testdata_path())
+ .env("DENO_FUTURE_CHECK", "1")
.arg("run")
.arg(&bundle)
.output()
@@ -289,7 +294,9 @@ 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)
.output()
.unwrap();
@@ -311,7 +318,6 @@ fn bundle_import_map_no_check() {
let mut deno = util::deno_cmd()
.current_dir(util::testdata_path())
.arg("bundle")
- .arg("--no-check")
.arg("--import-map")
.arg(import_map_path)
.arg(import)
@@ -334,6 +340,7 @@ 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()
@@ -366,6 +373,7 @@ fn bundle_json_module() {
let output = util::deno_cmd()
.current_dir(util::testdata_path())
+ .env("DENO_FUTURE_CHECK", "1")
.arg("run")
.arg(&bundle)
.output()
@@ -398,6 +406,7 @@ 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/check_tests.rs b/cli/tests/integration/check_tests.rs
new file mode 100644
index 000000000..f605a733a
--- /dev/null
+++ b/cli/tests/integration/check_tests.rs
@@ -0,0 +1,34 @@
+// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
+
+use crate::itest;
+
+itest!(_095_check_with_bare_import {
+ args: "check 095_cache_with_bare_import.ts",
+ output: "095_cache_with_bare_import.ts.out",
+ exit_code: 1,
+});
+
+itest!(check_extensionless {
+ args: "check --reload http://localhost:4545/subdir/no_js_ext",
+ output: "cache_extensionless.out",
+ http_server: true,
+});
+
+itest!(check_random_extension {
+ args: "check --reload http://localhost:4545/subdir/no_js_ext@1.0.0",
+ output: "cache_random_extension.out",
+ http_server: true,
+});
+
+itest!(check_all {
+ args: "check --quiet --remote check_all.ts",
+ output: "check_all.out",
+ http_server: true,
+ exit_code: 1,
+});
+
+itest!(check_all_local {
+ args: "check --quiet check_all.ts",
+ output_str: Some(""),
+ http_server: true,
+});
diff --git a/cli/tests/integration/inspector_tests.rs b/cli/tests/integration/inspector_tests.rs
index 71ecaf22e..86a5d4264 100644
--- a/cli/tests/integration/inspector_tests.rs
+++ b/cli/tests/integration/inspector_tests.rs
@@ -142,6 +142,7 @@ 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)
@@ -167,6 +168,7 @@ 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)
@@ -257,6 +259,7 @@ 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)
@@ -327,6 +330,7 @@ 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())
@@ -341,6 +345,7 @@ 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)
@@ -365,6 +370,7 @@ 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")
@@ -476,6 +482,7 @@ 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)
@@ -603,6 +610,7 @@ 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)
@@ -632,6 +640,7 @@ 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)
@@ -663,6 +672,7 @@ 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)
@@ -688,6 +698,7 @@ 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)
@@ -782,7 +793,9 @@ 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"))
.arg(script)
.stdout(std::process::Stdio::piped())
@@ -907,6 +920,7 @@ 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)
@@ -1021,6 +1035,7 @@ 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/mod.rs b/cli/tests/integration/mod.rs
index 86a980f59..2578989c7 100644
--- a/cli/tests/integration/mod.rs
+++ b/cli/tests/integration/mod.rs
@@ -56,6 +56,8 @@ mod bench;
mod bundle;
#[path = "cache_tests.rs"]
mod cache;
+#[path = "check_tests.rs"]
+mod check;
#[path = "compat_tests.rs"]
mod compat;
#[path = "compile_tests.rs"]
@@ -293,7 +295,9 @@ 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)
.output()
.expect("failed to spawn script");
@@ -315,7 +319,9 @@ 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)
.output()
.expect("failed to spawn script");
@@ -338,9 +344,11 @@ 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")
+ .arg("--check")
.arg(redirect_ts.clone())
.spawn()
.expect("failed to span script");
@@ -350,9 +358,11 @@ 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")
+ .arg("--check")
.arg(redirect_ts)
.output()
.expect("failed to spawn script");
@@ -652,7 +662,9 @@ 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)
.output()
.expect("failed to spawn script");
@@ -975,7 +987,9 @@ 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")
.arg("resolve_dns.ts")
.stdout(std::process::Stdio::piped())
@@ -1000,7 +1014,9 @@ 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")
.arg("resolve_dns.ts")
.stdout(std::process::Stdio::piped())
@@ -1025,7 +1041,9 @@ 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")
.arg("resolve_dns.ts")
.stdout(std::process::Stdio::piped())
@@ -1047,7 +1065,9 @@ 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")
.stdout(std::process::Stdio::piped())
.stderr(std::process::Stdio::piped())
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs
index 43a761204..a56e3f0f1 100644
--- a/cli/tests/integration/run_tests.rs
+++ b/cli/tests/integration/run_tests.rs
@@ -13,6 +13,7 @@ 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 {
@@ -104,8 +105,9 @@ itest!(_021_mjs_modules {
});
itest!(_023_no_ext {
- args: "run --reload 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
@@ -155,10 +157,11 @@ itest!(_034_onload {
});
itest!(_035_cached_only_flag {
- args: "run --reload --cached-only http://127.0.0.1:4545/019_media_types.ts",
+ args: "run --reload --check --cached-only http://127.0.0.1:4545/019_media_types.ts",
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 {
@@ -202,10 +205,12 @@ itest!(_048_media_types_jsx {
});
itest!(_052_no_remote_flag {
- args: "run --reload --no-remote http://127.0.0.1:4545/019_media_types.ts",
+ args:
+ "run --reload --check --no-remote http://127.0.0.1:4545/019_media_types.ts",
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 {
@@ -552,6 +557,7 @@ 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 {
@@ -559,6 +565,7 @@ 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 {
@@ -664,8 +671,9 @@ itest!(config_types_remote {
});
itest!(empty_typescript {
- args: "run --reload subdir/empty.ts",
+ 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 {
@@ -739,20 +747,23 @@ itest!(error_011_bad_module_specifier {
});
itest!(error_012_bad_dynamic_import_specifier {
- args: "run --reload error_012_bad_dynamic_import_specifier.ts",
+ 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 {
@@ -780,6 +791,7 @@ 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 {
@@ -853,12 +865,14 @@ 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 {
@@ -989,8 +1003,8 @@ itest!(lib_runtime_api {
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 {
@@ -999,9 +1013,10 @@ itest!(type_definitions {
});
itest!(type_definitions_for_export {
- args: "run --reload type_definitions_for_export.ts",
+ 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 {
@@ -1022,37 +1037,43 @@ itest!(type_directives_js_main {
});
itest!(type_directives_redirect {
- args: "run --reload type_directives_redirect.ts",
+ 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 type_headers_deno_types.ts",
+ 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 ts_type_imports.ts",
+ 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 ts_decorators.ts",
+ 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 ts_type_only_import.ts",
+ 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 swc_syntax_error.ts",
+ 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 {
@@ -1068,6 +1089,7 @@ 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 {
@@ -1100,12 +1122,14 @@ 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 {
@@ -1123,34 +1147,40 @@ 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 {
@@ -1182,6 +1212,7 @@ 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 {
@@ -1220,13 +1251,15 @@ itest!(dynamic_import_conditional {
});
itest!(tsx_imports {
- args: "run --reload tsx_imports.ts",
+ 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 {
@@ -1401,6 +1434,7 @@ 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 {
@@ -1497,6 +1531,7 @@ 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
@@ -1548,6 +1583,7 @@ 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
@@ -1555,6 +1591,7 @@ 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 {
@@ -1589,9 +1626,10 @@ itest!(worker_close_in_wasm_reactions {
});
itest!(reference_types_error {
- args: "run --config checkjs.tsconfig.json reference_types_error.js",
+ 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 {
@@ -1600,9 +1638,10 @@ itest!(reference_types_error_no_check {
});
itest!(jsx_import_source_error {
- args: "run --config jsx/deno-jsx-error.jsonc jsx_import_source_no_pragma.tsx",
+ 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 {
@@ -1631,6 +1670,7 @@ 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())
@@ -1775,6 +1815,7 @@ 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())
@@ -1788,6 +1829,7 @@ 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")
@@ -2362,6 +2404,7 @@ 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())],
});
#[test]
@@ -2493,11 +2536,13 @@ 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 {
@@ -2515,6 +2560,7 @@ 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.
@@ -2528,88 +2574,114 @@ 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())],
});
diff --git a/cli/tests/integration/watcher_tests.rs b/cli/tests/integration/watcher_tests.rs
index 2f2bc9851..939a11c0c 100644
--- a/cli/tests/integration/watcher_tests.rs
+++ b/cli/tests/integration/watcher_tests.rs
@@ -633,6 +633,7 @@ fn run_watch_load_unload_events() {
.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()
@@ -688,6 +689,7 @@ fn run_watch_not_exit() {
.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()
@@ -748,6 +750,7 @@ 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()
@@ -971,6 +974,7 @@ 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()
@@ -1004,6 +1008,7 @@ fn watch_with_no_clear_screen_flag() {
.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()
diff --git a/cli/tests/testdata/check_all.out b/cli/tests/testdata/check_all.out
new file mode 100644
index 000000000..344264634
--- /dev/null
+++ b/cli/tests/testdata/check_all.out
@@ -0,0 +1,4 @@
+error: TS2322 [ERROR]: Type '12' is not assignable to type '"a"'.
+export const a: "a" = 12;
+ ^
+ at http://localhost:4545/subdir/type_error.ts:1:14
diff --git a/cli/tests/testdata/check_all.ts b/cli/tests/testdata/check_all.ts
new file mode 100644
index 000000000..2ae8c2692
--- /dev/null
+++ b/cli/tests/testdata/check_all.ts
@@ -0,0 +1,3 @@
+import * as a from "http://localhost:4545/subdir/type_error.ts";
+
+console.log(a.a);
diff --git a/cli/tests/testdata/future_check.ts b/cli/tests/testdata/future_check.ts
new file mode 100644
index 000000000..4d41fe06a
--- /dev/null
+++ b/cli/tests/testdata/future_check.ts
@@ -0,0 +1 @@
+Deno.metrics();
diff --git a/cli/tests/testdata/future_check1.out b/cli/tests/testdata/future_check1.out
new file mode 100644
index 000000000..9c7592fc5
--- /dev/null
+++ b/cli/tests/testdata/future_check1.out
@@ -0,0 +1,3 @@
+Warning In future releases `deno run` will not automatically type check without the --check flag.
+To opt into this new behavior now, specify DENO_FUTURE_CHECK=1.
+Check [WILDCARD]/future_check.ts
diff --git a/cli/tests/testdata/future_check2.out b/cli/tests/testdata/future_check2.out
new file mode 100644
index 000000000..c626a5485
--- /dev/null
+++ b/cli/tests/testdata/future_check2.out
@@ -0,0 +1 @@
+Check [WILDCARD]/future_check.ts