From 30b2779bb6239f7a59d64cec65637d83118f3c8f Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Mon, 17 May 2021 12:59:11 +0200 Subject: [PATCH] tests: fix broken tests on main (#10663) --- cli/tests/dynamic_import/permissions_blob_local.ts | 4 +++- cli/tests/dynamic_import/permissions_blob_local.ts.out | 4 ++-- cli/tests/dynamic_import/permissions_data_local.ts | 4 +++- cli/tests/dynamic_import/permissions_data_local.ts.out | 6 +++--- cli/tests/workers/permissions_blob_local.ts | 4 +++- cli/tests/workers/permissions_blob_local.ts.out | 2 +- cli/tests/workers/permissions_data_local.ts | 4 +++- cli/tests/workers/permissions_data_local.ts.out | 4 ++-- cli/tests/workers/permissions_dynamic_remote.ts.out | 6 +----- 9 files changed, 21 insertions(+), 17 deletions(-) diff --git a/cli/tests/dynamic_import/permissions_blob_local.ts b/cli/tests/dynamic_import/permissions_blob_local.ts index 571c72ca33..9ef4158ce9 100644 --- a/cli/tests/dynamic_import/permissions_blob_local.ts +++ b/cli/tests/dynamic_import/permissions_blob_local.ts @@ -1,4 +1,6 @@ // This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///local_file.ts";`; +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/dynamic_import/permissions_blob_local.ts.out b/cli/tests/dynamic_import/permissions_blob_local.ts.out index d533d49036..5a2da0536e 100644 --- a/cli/tests/dynamic_import/permissions_blob_local.ts.out +++ b/cli/tests/dynamic_import/permissions_blob_local.ts.out @@ -1,5 +1,5 @@ -error: Uncaught (in promise) TypeError: Requires read access to "/local_file.ts", run again with the --allow-read flag +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:0 await import(URL.createObjectURL(blob)); ^ - at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_blob_local.ts:4:1 + at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_blob_local.ts:6:1 diff --git a/cli/tests/dynamic_import/permissions_data_local.ts b/cli/tests/dynamic_import/permissions_data_local.ts index 04b3432eb4..be4fc1c346 100644 --- a/cli/tests/dynamic_import/permissions_data_local.ts +++ b/cli/tests/dynamic_import/permissions_data_local.ts @@ -1,3 +1,5 @@ // This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///local_file.ts";`; +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/dynamic_import/permissions_data_local.ts.out b/cli/tests/dynamic_import/permissions_data_local.ts.out index 0b3ac77799..39686740ad 100644 --- a/cli/tests/dynamic_import/permissions_data_local.ts.out +++ b/cli/tests/dynamic_import/permissions_data_local.ts.out @@ -1,5 +1,5 @@ -error: Uncaught (in promise) TypeError: Requires read access to "/local_file.ts", run again with the --allow-read flag - at data:application/javascript;base64,aW1wb3J0ICJmaWxlOi8vL2xvY2FsX2ZpbGUudHMiOw==:1: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:0 await import(`data:application/javascript;base64,${btoa(code)}`); ^ - at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_data_local.ts:3:1 + at async file:///[WILDCARD]/cli/tests/dynamic_import/permissions_data_local.ts:5:1 diff --git a/cli/tests/workers/permissions_blob_local.ts b/cli/tests/workers/permissions_blob_local.ts index e755579126..52f630bd8a 100644 --- a/cli/tests/workers/permissions_blob_local.ts +++ b/cli/tests/workers/permissions_blob_local.ts @@ -1,4 +1,6 @@ // This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///local_file.ts";`; +const code = `import "file:///${ + Deno.build.os == "windows" ? "C:/" : "" +}local_file.ts";`; const blob = new Blob([code]); new Worker(URL.createObjectURL(blob), { type: "module" }); diff --git a/cli/tests/workers/permissions_blob_local.ts.out b/cli/tests/workers/permissions_blob_local.ts.out index 7ccb56e1d4..fab2388d8d 100644 --- a/cli/tests/workers/permissions_blob_local.ts.out +++ b/cli/tests/workers/permissions_blob_local.ts.out @@ -1,4 +1,4 @@ -error: Uncaught (in worker "") Requires read access to "/local_file.ts", run again with the --allow-read flag +error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag at blob:null/[WILDCARD]:1:0 error: Uncaught (in promise) Error: Unhandled error event reached main worker. at Worker.#poll (deno:runtime/js/11_workers.js:246:23) diff --git a/cli/tests/workers/permissions_data_local.ts b/cli/tests/workers/permissions_data_local.ts index 938a76add5..cda80bed61 100644 --- a/cli/tests/workers/permissions_data_local.ts +++ b/cli/tests/workers/permissions_data_local.ts @@ -1,5 +1,7 @@ // This file doesn't really exist, but it doesn't matter, a "PermissionsDenied" error should be thrown. -const code = `import "file:///local_file.ts";`; +const code = `import "file:///${ + Deno.build.os == "windows" ? "C:/" : "" +}local_file.ts";`; new Worker(`data:application/javascript;base64,${btoa(code)}`, { type: "module", }); diff --git a/cli/tests/workers/permissions_data_local.ts.out b/cli/tests/workers/permissions_data_local.ts.out index e282bb5aaf..a1e1de8ab4 100644 --- a/cli/tests/workers/permissions_data_local.ts.out +++ b/cli/tests/workers/permissions_data_local.ts.out @@ -1,4 +1,4 @@ -error: Uncaught (in worker "") Requires read access to "/local_file.ts", run again with the --allow-read flag - at data:application/javascript;base64,aW1wb3J0ICJmaWxlOi8vL2xvY2FsX2ZpbGUudHMiOw==:1:0 +error: Uncaught (in worker "") Requires read access to "[WILDCARD]local_file.ts", run again with the --allow-read flag + at data:application/javascript;base64,[WILDCARD]:1:0 error: Uncaught (in promise) Error: Unhandled error event reached main worker. at Worker.#poll (deno:runtime/js/11_workers.js:246:23) diff --git a/cli/tests/workers/permissions_dynamic_remote.ts.out b/cli/tests/workers/permissions_dynamic_remote.ts.out index 3bfb162053..8600fa1916 100644 --- a/cli/tests/workers/permissions_dynamic_remote.ts.out +++ b/cli/tests/workers/permissions_dynamic_remote.ts.out @@ -2,9 +2,5 @@ error: Uncaught (in worker "") (in promise) TypeError: Requires net access to "e await import("https://example.com/some/file.ts"); ^ at async http://localhost:4545/cli/tests/workers/dynamic_remote.ts:2:1 -error: Uncaught (in worker "") TypeError: Requires net access to "example.com", run again with the --allow-net flag -await import("https://example.com/some/file.ts"); -^ - at async http://localhost:4545/cli/tests/workers/dynamic_remote.ts:2:1 -error: Uncaught (in promise) Error: Unhandled error event reached main worker. +[WILDCARD]error: Uncaught (in promise) Error: Unhandled error event reached main worker. at Worker.#poll (deno:runtime/js/11_workers.js:246:23)