From f5e46c9bf2f50d66a953fa133161fc829cecff06 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Sat, 10 Feb 2024 13:22:13 -0700 Subject: chore: move cli/tests/ -> tests/ (#22369) This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit. --- cli/tests/testdata/dynamic_import/b.js | 2 -- cli/tests/testdata/dynamic_import/c.js | 2 -- cli/tests/testdata/dynamic_import/empty_1.ts | 0 cli/tests/testdata/dynamic_import/empty_2.ts | 0 cli/tests/testdata/dynamic_import/permissions_blob_local.ts | 6 ------ .../testdata/dynamic_import/permissions_blob_local.ts.out | 5 ----- .../testdata/dynamic_import/permissions_blob_remote.ts | 4 ---- .../testdata/dynamic_import/permissions_blob_remote.ts.out | 5 ----- cli/tests/testdata/dynamic_import/permissions_data_local.ts | 5 ----- .../testdata/dynamic_import/permissions_data_local.ts.out | 5 ----- .../testdata/dynamic_import/permissions_data_remote.ts | 3 --- .../testdata/dynamic_import/permissions_data_remote.ts.out | 5 ----- .../testdata/dynamic_import/permissions_remote_remote.ts | 3 --- .../dynamic_import/permissions_remote_remote.ts.out | 5 ----- .../dynamic_import/static_analysis_no_permissions.ts | 13 ------------- .../dynamic_import/static_analysis_no_permissions.ts.out | 2 -- cli/tests/testdata/dynamic_import/static_remote.ts | 2 -- 17 files changed, 67 deletions(-) delete mode 100644 cli/tests/testdata/dynamic_import/b.js delete mode 100644 cli/tests/testdata/dynamic_import/c.js delete mode 100644 cli/tests/testdata/dynamic_import/empty_1.ts delete mode 100644 cli/tests/testdata/dynamic_import/empty_2.ts delete mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_local.ts delete mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out delete mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_remote.ts delete mode 100644 cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out delete mode 100644 cli/tests/testdata/dynamic_import/permissions_data_local.ts delete mode 100644 cli/tests/testdata/dynamic_import/permissions_data_local.ts.out delete mode 100644 cli/tests/testdata/dynamic_import/permissions_data_remote.ts delete mode 100644 cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out delete mode 100644 cli/tests/testdata/dynamic_import/permissions_remote_remote.ts delete mode 100644 cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out delete mode 100644 cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts delete mode 100644 cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts.out delete mode 100644 cli/tests/testdata/dynamic_import/static_remote.ts (limited to 'cli/tests/testdata/dynamic_import') diff --git a/cli/tests/testdata/dynamic_import/b.js b/cli/tests/testdata/dynamic_import/b.js deleted file mode 100644 index 6ea50d360..000000000 --- a/cli/tests/testdata/dynamic_import/b.js +++ /dev/null @@ -1,2 +0,0 @@ -import "./bad.mjs"; -export default () => "error"; diff --git a/cli/tests/testdata/dynamic_import/c.js b/cli/tests/testdata/dynamic_import/c.js deleted file mode 100644 index 20546455e..000000000 --- a/cli/tests/testdata/dynamic_import/c.js +++ /dev/null @@ -1,2 +0,0 @@ -await import("./bad2.mjs"); -export default () => "error"; diff --git a/cli/tests/testdata/dynamic_import/empty_1.ts b/cli/tests/testdata/dynamic_import/empty_1.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/dynamic_import/empty_2.ts b/cli/tests/testdata/dynamic_import/empty_2.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_local.ts b/cli/tests/testdata/dynamic_import/permissions_blob_local.ts deleted file mode 100644 index 9ef4158ce..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_blob_local.ts +++ /dev/null @@ -1,6 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///${ - Deno.build.os == "windows" ? "C:/" : "" -}local_file.ts";`; -const blob = new Blob([code]); -await import(URL.createObjectURL(blob)); diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out b/cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out deleted file mode 100644 index b7b246ba2..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_blob_local.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag - at blob:null/[WILDCARD]:1:8 -await import(URL.createObjectURL(blob)); -^ - at async file://[WILDCARD]/permissions_blob_local.ts:6:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts b/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts deleted file mode 100644 index 1e2c8c21a..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts +++ /dev/null @@ -1,4 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "https://example.com/some/file.ts";`; -const blob = new Blob([code]); -await import(URL.createObjectURL(blob)); diff --git a/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out b/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out deleted file mode 100644 index a00c02d72..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_blob_remote.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag - at blob:null/[WILDCARD]:1:8 -await import(URL.createObjectURL(blob)); -^ - at async file:///[WILDCARD]/dynamic_import/permissions_blob_remote.ts:4:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_data_local.ts b/cli/tests/testdata/dynamic_import/permissions_data_local.ts deleted file mode 100644 index be4fc1c34..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_data_local.ts +++ /dev/null @@ -1,5 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///${ - Deno.build.os == "windows" ? "C:/" : "" -}local_file.ts";`; -await import(`data:application/javascript;base64,${btoa(code)}`); diff --git a/cli/tests/testdata/dynamic_import/permissions_data_local.ts.out b/cli/tests/testdata/dynamic_import/permissions_data_local.ts.out deleted file mode 100644 index 98c8a7310..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_data_local.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag - at data:application/javascript;base64,[WILDCARD]:1:8 -await import(`data:application/javascript;base64,${btoa(code)}`); -^ - at async file:///[WILDCARD]/dynamic_import/permissions_data_local.ts:5:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_data_remote.ts b/cli/tests/testdata/dynamic_import/permissions_data_remote.ts deleted file mode 100644 index b0a9540c3..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_data_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "https://example.com/some/file.ts";`; -await import(`data:application/javascript;base64,${btoa(code)}`); diff --git a/cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out b/cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out deleted file mode 100644 index cb2a7ccf7..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_data_remote.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag - at data:application/javascript;base64,aW1wb3J0ICJodHRwczovL2V4YW1wbGUuY29tL3NvbWUvZmlsZS50cyI7:1:8 -await import(`data:application/javascript;base64,${btoa(code)}`); -^ - at async file:///[WILDCARD]/dynamic_import/permissions_data_remote.ts:3:1 diff --git a/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts b/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts deleted file mode 100644 index 65a254191..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts +++ /dev/null @@ -1,3 +0,0 @@ -await import( - "" + "http://localhost:4545/dynamic_import/static_remote.ts" -); diff --git a/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out b/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out deleted file mode 100644 index bd88dd4d9..000000000 --- a/cli/tests/testdata/dynamic_import/permissions_remote_remote.ts.out +++ /dev/null @@ -1,5 +0,0 @@ -error: Uncaught (in promise) TypeError: Requires net access to "example.com", run again with the --allow-net flag - at http://localhost:4545/dynamic_import/static_remote.ts:2:8 -await import( -^ - at async file:///[WILDCARD]/dynamic_import/permissions_remote_remote.ts:1:1 diff --git a/cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts b/cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts deleted file mode 100644 index de75ba87b..000000000 --- a/cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts +++ /dev/null @@ -1,13 +0,0 @@ -try { - await import("./empty_1.ts"); - console.log("✅ Succeeded importing statically analyzable specifier"); -} catch { - console.log("❌ Failed importing statically analyzable specifier"); -} - -try { - await import("" + "./empty_2.ts"); - console.log("❌ Succeeded importing non-statically analyzable specifier"); -} catch { - console.log("✅ Failed importing non-statically analyzable specifier"); -} diff --git a/cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts.out b/cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts.out deleted file mode 100644 index ba9249ab0..000000000 --- a/cli/tests/testdata/dynamic_import/static_analysis_no_permissions.ts.out +++ /dev/null @@ -1,2 +0,0 @@ -✅ Succeeded importing statically analyzable specifier -✅ Failed importing non-statically analyzable specifier diff --git a/cli/tests/testdata/dynamic_import/static_remote.ts b/cli/tests/testdata/dynamic_import/static_remote.ts deleted file mode 100644 index 2d6e820fd..000000000 --- a/cli/tests/testdata/dynamic_import/static_remote.ts +++ /dev/null @@ -1,2 +0,0 @@ -// This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -import "https://example.com/some/file.ts"; -- cgit v1.2.3