diff options
Diffstat (limited to 'cli/tests')
16 files changed, 37 insertions, 14 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 214eb8ece..2d96fab8f 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -2271,3 +2271,37 @@ fn issue12453() { .unwrap(); assert!(status.success()); } + +/// Regression test for https://github.com/denoland/deno/issues/12740. +#[test] +fn issue12740() { + let mod_dir = TempDir::new().expect("tempdir fail"); + let mod1_path = mod_dir.path().join("mod1.ts"); + let mod2_path = mod_dir.path().join("mod2.ts"); + let mut deno_cmd = util::deno_cmd(); + std::fs::write(&mod1_path, "").unwrap(); + let status = deno_cmd + .current_dir(util::testdata_path()) + .arg("run") + .arg(&mod1_path) + .stderr(std::process::Stdio::null()) + .stdout(std::process::Stdio::null()) + .spawn() + .unwrap() + .wait() + .unwrap(); + assert!(status.success()); + std::fs::write(&mod1_path, "export { foo } from \"./mod2.ts\";").unwrap(); + std::fs::write(&mod2_path, "(").unwrap(); + let status = deno_cmd + .current_dir(util::testdata_path()) + .arg("run") + .arg(&mod1_path) + .stderr(std::process::Stdio::null()) + .stdout(std::process::Stdio::null()) + .spawn() + .unwrap() + .wait() + .unwrap(); + assert!(!status.success()); +} diff --git a/cli/tests/testdata/095_cache_with_bare_import.ts.out b/cli/tests/testdata/095_cache_with_bare_import.ts.out index f424f4c3e..ef4820386 100644 --- a/cli/tests/testdata/095_cache_with_bare_import.ts.out +++ b/cli/tests/testdata/095_cache_with_bare_import.ts.out @@ -1 +1,2 @@ [WILDCARD]error: Relative import path "foo" not prefixed with / or ./ or ../ from "file:///[WILDCARD]/095_cache_with_bare_import.ts" + at file:///[WILDCARD]/095_cache_with_bare_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/disallow_http_from_https_js.out b/cli/tests/testdata/disallow_http_from_https_js.out index 428078399..e4f9e8d59 100644 --- a/cli/tests/testdata/disallow_http_from_https_js.out +++ b/cli/tests/testdata/disallow_http_from_https_js.out @@ -1,4 +1,3 @@ error: Modules imported via https are not allowed to import http modules. Importing: http://localhost:4545/001_hello.js at https://localhost:5545/disallow_http_from_https.js:2:8 - diff --git a/cli/tests/testdata/disallow_http_from_https_ts.out b/cli/tests/testdata/disallow_http_from_https_ts.out index bd986cbce..3f885001f 100644 --- a/cli/tests/testdata/disallow_http_from_https_ts.out +++ b/cli/tests/testdata/disallow_http_from_https_ts.out @@ -1,4 +1,3 @@ error: Modules imported via https are not allowed to import http modules. Importing: http://localhost:4545/001_hello.js at https://localhost:5545/disallow_http_from_https.ts:2:8 - diff --git a/cli/tests/testdata/error_011_bad_module_specifier.ts.out b/cli/tests/testdata/error_011_bad_module_specifier.ts.out index 9ee9fd4d1..7d46f6bc8 100644 --- a/cli/tests/testdata/error_011_bad_module_specifier.ts.out +++ b/cli/tests/testdata/error_011_bad_module_specifier.ts.out @@ -1,3 +1,2 @@ [WILDCARD]error: Relative import path "bad-module.ts" not prefixed with / or ./ or ../ from "[WILDCARD]/error_011_bad_module_specifier.ts" at [WILDCARD]/error_011_bad_module_specifier.ts:1:28 - diff --git a/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out b/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out index b19d87515..67cf0e0bb 100644 --- a/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out +++ b/cli/tests/testdata/error_014_catch_dynamic_import_error.js.out @@ -6,7 +6,6 @@ TypeError: Relative import path "does not exist" not prefixed with / or ./ or .. Caught indirect direct dynamic import error. TypeError: Relative import path "does not exist either" not prefixed with / or ./ or ../ from "[WILDCARD]/subdir/indirect_import_error.js" at [WILDCARD]/subdir/indirect_import_error.js:1:15 - at async [WILDCARD]/error_014_catch_dynamic_import_error.js:10:5 Caught error thrown by dynamically imported module. Error: An error diff --git a/cli/tests/testdata/error_015_dynamic_import_permissions.out b/cli/tests/testdata/error_015_dynamic_import_permissions.out index 42fb0a15d..ef54f331b 100644 --- a/cli/tests/testdata/error_015_dynamic_import_permissions.out +++ b/cli/tests/testdata/error_015_dynamic_import_permissions.out @@ -1,5 +1,4 @@ error: Uncaught (in promise) TypeError: Requires net access to "localhost:4545", run again with the --allow-net flag - at file://[WILDCARD]/error_015_dynamic_import_permissions.js:2:16 await import("http://localhost:4545/subdir/mod4.js"); ^ at async file://[WILDCARD]/error_015_dynamic_import_permissions.js:2:3 diff --git a/cli/tests/testdata/error_016_dynamic_import_permissions2.out b/cli/tests/testdata/error_016_dynamic_import_permissions2.out index bdfddb9ed..710871f41 100644 --- a/cli/tests/testdata/error_016_dynamic_import_permissions2.out +++ b/cli/tests/testdata/error_016_dynamic_import_permissions2.out @@ -2,7 +2,6 @@ error: Uncaught (in promise) TypeError: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. Importing: file:///c:/etc/passwd at http://localhost:4545/subdir/evil_remote_import.js:3:15 - await import("http://localhost:4545/subdir/evil_remote_import.js"); ^ at async file://[WILDCARD]/error_016_dynamic_import_permissions2.js:4:3 diff --git a/cli/tests/testdata/error_local_static_import_from_remote.js.out b/cli/tests/testdata/error_local_static_import_from_remote.js.out index 8904bae29..1ea10bd88 100644 --- a/cli/tests/testdata/error_local_static_import_from_remote.js.out +++ b/cli/tests/testdata/error_local_static_import_from_remote.js.out @@ -2,4 +2,3 @@ error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. Importing: file:///some/dir/file.js at http://localhost:4545/error_local_static_import_from_remote.js:1:8 - diff --git a/cli/tests/testdata/error_local_static_import_from_remote.ts.out b/cli/tests/testdata/error_local_static_import_from_remote.ts.out index b06a12454..7308c6f9d 100644 --- a/cli/tests/testdata/error_local_static_import_from_remote.ts.out +++ b/cli/tests/testdata/error_local_static_import_from_remote.ts.out @@ -2,4 +2,3 @@ error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead. Importing: file:///some/dir/file.ts at http://localhost:4545/error_local_static_import_from_remote.ts:1:8 - diff --git a/cli/tests/testdata/error_missing_module_named_import.ts.out b/cli/tests/testdata/error_missing_module_named_import.ts.out index c6867130e..d1162ab52 100644 --- a/cli/tests/testdata/error_missing_module_named_import.ts.out +++ b/cli/tests/testdata/error_missing_module_named_import.ts.out @@ -1,2 +1,3 @@ [WILDCARD] error: Cannot load module "file://[WILDCARD]/does_not_exist.js". + at file:///[WILDCARD]/error_missing_module_named_import.ts:[WILDCARD] diff --git a/cli/tests/testdata/import_blob_url_import_relative.ts.out b/cli/tests/testdata/import_blob_url_import_relative.ts.out index 75e5fe811..59a6f07fb 100644 --- a/cli/tests/testdata/import_blob_url_import_relative.ts.out +++ b/cli/tests/testdata/import_blob_url_import_relative.ts.out @@ -1,6 +1,5 @@ error: Uncaught (in promise) TypeError: invalid URL: relative URL with a cannot-be-a-base base at blob:null/[WILDCARD]:1:19 - const a = await import(url); ^ at async file://[WILDCARD]/import_blob_url_import_relative.ts:6:11 diff --git a/cli/tests/testdata/import_data_url_import_relative.ts.out b/cli/tests/testdata/import_data_url_import_relative.ts.out index ed1a37208..821c3e4df 100644 --- a/cli/tests/testdata/import_data_url_import_relative.ts.out +++ b/cli/tests/testdata/import_data_url_import_relative.ts.out @@ -1,3 +1,2 @@ error: invalid URL: relative URL with a cannot-be-a-base base at data:application/javascript;base64,ZXhwb3J0IHsgYSB9IGZyb20gIi4vYS50cyI7Cg==:1:19 - diff --git a/cli/tests/testdata/localhost_unsafe_ssl.ts.out b/cli/tests/testdata/localhost_unsafe_ssl.ts.out index e92e5e819..66c199417 100644 --- a/cli/tests/testdata/localhost_unsafe_ssl.ts.out +++ b/cli/tests/testdata/localhost_unsafe_ssl.ts.out @@ -1,2 +1,3 @@ DANGER: TLS certificate validation is disabled for: deno.land error: error sending request for url (https://localhost:5545/subdir/mod2.ts): error trying to connect: invalid certificate: UnknownIssuer + at file:///[WILDCARD]/cafile_url_imports.ts:[WILDCARD] diff --git a/cli/tests/testdata/ts_type_only_import.ts.out b/cli/tests/testdata/ts_type_only_import.ts.out index 9304a987e..42852cd26 100644 --- a/cli/tests/testdata/ts_type_only_import.ts.out +++ b/cli/tests/testdata/ts_type_only_import.ts.out @@ -1,4 +1 @@ Check file://[WILDCARD]/ts_type_only_import.ts -warning: Cannot load module "file://[WILDCARD]/ts_type_only_import.d.ts". - at file://[WILDCARD]/ts_type_only_import.ts:1:15 - If the source module contains only types, use `import type` and `export type` to import it instead. diff --git a/cli/tests/testdata/workers/permissions_dynamic_remote.ts.out b/cli/tests/testdata/workers/permissions_dynamic_remote.ts.out index 57a922391..e5015abff 100644 --- a/cli/tests/testdata/workers/permissions_dynamic_remote.ts.out +++ b/cli/tests/testdata/workers/permissions_dynamic_remote.ts.out @@ -1,5 +1,4 @@ error: Uncaught (in worker "") (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag - at http://localhost:4545/workers/dynamic_remote.ts:2:14 await import("https://example.com/some/file.ts"); ^ at async http://localhost:4545/workers/dynamic_remote.ts:2:1 |