diff options
Diffstat (limited to 'cli/tests/unit')
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 48 | ||||
-rw-r--r-- | cli/tests/unit/files_test.ts | 30 | ||||
-rw-r--r-- | cli/tests/unit/flock_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/net_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/read_dir_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/read_file_test.ts | 20 | ||||
-rw-r--r-- | cli/tests/unit/read_text_file_test.ts | 22 | ||||
-rw-r--r-- | cli/tests/unit/real_path_test.ts | 8 | ||||
-rw-r--r-- | cli/tests/unit/resources_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/stat_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/tty_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/wasm_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/webgpu_test.ts | 6 |
13 files changed, 78 insertions, 76 deletions
diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index cbb2cd680..096ea5ab0 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -93,40 +93,40 @@ Deno.test( ); Deno.test({ permissions: { net: true } }, async function fetchJsonSuccess() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const json = await response.json(); assertEquals(json.name, "deno"); }); Deno.test({ permissions: { net: false } }, async function fetchPerm() { await assertRejects(async () => { - await fetch("http://localhost:4545/fixture.json"); + await fetch("http://localhost:4545/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); Deno.test({ permissions: { net: true } }, async function fetchUrl() { - const response = await fetch("http://localhost:4545/fixture.json"); - assertEquals(response.url, "http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); + assertEquals(response.url, "http://localhost:4545/assets/fixture.json"); const _json = await response.json(); }); Deno.test({ permissions: { net: true } }, async function fetchURL() { const response = await fetch( - new URL("http://localhost:4545/fixture.json"), + new URL("http://localhost:4545/assets/fixture.json"), ); - assertEquals(response.url, "http://localhost:4545/fixture.json"); + assertEquals(response.url, "http://localhost:4545/assets/fixture.json"); const _json = await response.json(); }); Deno.test({ permissions: { net: true } }, async function fetchHeaders() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; assertEquals(headers.get("Content-Type"), "application/json"); const _json = await response.json(); }); Deno.test({ permissions: { net: true } }, async function fetchBlob() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; const blob = await response.blob(); assertEquals(blob.type, headers.get("Content-Type")); @@ -137,7 +137,7 @@ Deno.test( { permissions: { net: true } }, async function fetchBodyUsedReader() { const response = await fetch( - "http://localhost:4545/fixture.json", + "http://localhost:4545/assets/fixture.json", ); assert(response.body !== null); @@ -155,7 +155,7 @@ Deno.test( { permissions: { net: true } }, async function fetchBodyUsedCancelStream() { const response = await fetch( - "http://localhost:4545/fixture.json", + "http://localhost:4545/assets/fixture.json", ); assert(response.body !== null); @@ -167,7 +167,7 @@ Deno.test( ); Deno.test({ permissions: { net: true } }, async function fetchAsyncIterator() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; assert(response.body !== null); @@ -181,7 +181,7 @@ Deno.test({ permissions: { net: true } }, async function fetchAsyncIterator() { }); Deno.test({ permissions: { net: true } }, async function fetchBodyReader() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const headers = response.headers; assert(response.body !== null); const reader = response.body.getReader(); @@ -220,7 +220,7 @@ Deno.test( ); Deno.test({ permissions: { net: true } }, async function responseClone() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); const response1 = response.clone(); assert(response !== response1); assertEquals(response.status, response1.status); @@ -359,10 +359,10 @@ Deno.test( permissions: { net: true }, }, async function fetchWithRedirection() { - const response = await fetch("http://localhost:4546/hello.txt"); + const response = await fetch("http://localhost:4546/assets/hello.txt"); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); - assertEquals(response.url, "http://localhost:4545/hello.txt"); + assertEquals(response.url, "http://localhost:4545/assets/hello.txt"); const body = await response.text(); assert(body.includes("Hello world!")); }, @@ -374,7 +374,7 @@ Deno.test( }, async function fetchWithRelativeRedirection() { const response = await fetch( - "http://localhost:4545/001_hello.js", + "http://localhost:4545/run/001_hello.js", ); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); @@ -449,7 +449,7 @@ Deno.test( { permissions: { net: true } }, async function fetchSeparateInit() { // related to: https://github.com/denoland/deno/issues/10396 - const req = new Request("http://localhost:4545/001_hello.js"); + const req = new Request("http://localhost:4545/run/001_hello.js"); const init = { method: "GET", }; @@ -901,7 +901,7 @@ Deno.test(async function responseWithoutBody() { }); Deno.test({ permissions: { net: true } }, async function fetchBodyReadTwice() { - const response = await fetch("http://localhost:4545/fixture.json"); + const response = await fetch("http://localhost:4545/assets/fixture.json"); // Read body const _json = await response.json(); @@ -925,7 +925,7 @@ Deno.test( { permissions: { net: true } }, async function fetchBodyReaderAfterRead() { const response = await fetch( - "http://localhost:4545/fixture.json", + "http://localhost:4545/assets/fixture.json", ); assert(response.body !== null); const reader = await response.body.getReader(); @@ -1005,7 +1005,7 @@ Deno.test( Deno.test( { permissions: { net: true } }, async function fetchResourceCloseAfterStreamCancel() { - const res = await fetch("http://localhost:4545/fixture.json"); + const res = await fetch("http://localhost:4545/assets/fixture.json"); assert(res.body !== null); // After ReadableStream.cancel is called, resource handle must be closed @@ -1113,7 +1113,7 @@ Deno.test( > { const caCert = Deno.readTextFileSync("cli/tests/testdata/tls/RootCA.pem"); const client = Deno.createHttpClient({ caCerts: [caCert] }); - const response = await fetch("https://localhost:5545/fixture.json", { + const response = await fetch("https://localhost:5545/assets/fixture.json", { client, }); const json = await response.json(); @@ -1286,7 +1286,7 @@ Deno.test( "cli/tests/testdata/tls/localhost.key", ), }); - await fetch("https://localhost:5552/fixture.json", { + await fetch("https://localhost:5552/assets/fixture.json", { client, }); }, Deno.errors.InvalidData); @@ -1303,7 +1303,7 @@ Deno.test( ), privateKey: "bad data", }); - await fetch("https://localhost:5552/fixture.json", { + await fetch("https://localhost:5552/assets/fixture.json", { client, }); }, Deno.errors.InvalidData); @@ -1320,7 +1320,7 @@ Deno.test( ), privateKey: "", }); - await fetch("https://localhost:5552/fixture.json", { + await fetch("https://localhost:5552/assets/fixture.json", { client, }); }, Deno.errors.InvalidData); diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index d15f1f538..bb095072c 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -17,7 +17,7 @@ Deno.test(function filesStdioFileDescriptors() { }); Deno.test({ permissions: { read: true } }, async function filesCopyToStdout() { - const filename = "cli/tests/testdata/fixture.json"; + const filename = "cli/tests/testdata/assets/fixture.json"; const file = await Deno.open(filename); assert(file.rid > 2); const bytesWritten = await copy(file, Deno.stdout); @@ -27,7 +27,7 @@ Deno.test({ permissions: { read: true } }, async function filesCopyToStdout() { }); Deno.test({ permissions: { read: true } }, async function filesIter() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); let totalSize = 0; @@ -42,7 +42,7 @@ Deno.test({ permissions: { read: true } }, async function filesIter() { Deno.test( { permissions: { read: true } }, async function filesIterCustomBufSize() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); let totalSize = 0; @@ -59,7 +59,7 @@ Deno.test( ); Deno.test({ permissions: { read: true } }, function filesIterSync() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); let totalSize = 0; @@ -74,7 +74,7 @@ Deno.test({ permissions: { read: true } }, function filesIterSync() { Deno.test( { permissions: { read: true } }, function filesIterSyncCustomBufSize() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); let totalSize = 0; @@ -264,7 +264,7 @@ Deno.test( ); Deno.test(async function openOptions() { - const filename = "cli/tests/testdata/fixture.json"; + const filename = "cli/tests/testdata/assets/fixture.json"; await assertRejects( async () => { await Deno.open(filename, { write: false }); @@ -558,7 +558,7 @@ Deno.test( ); Deno.test({ permissions: { read: true } }, async function seekStart() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const seekPosition = 6; // Deliberately move 1 step forward @@ -575,7 +575,7 @@ Deno.test({ permissions: { read: true } }, async function seekStart() { }); Deno.test({ permissions: { read: true } }, function seekSyncStart() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); const seekPosition = 6; // Deliberately move 1 step forward @@ -592,7 +592,7 @@ Deno.test({ permissions: { read: true } }, function seekSyncStart() { }); Deno.test({ permissions: { read: true } }, async function seekCurrent() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); // Deliberately move 1 step forward await file.read(new Uint8Array(1)); // "H" @@ -609,7 +609,7 @@ Deno.test({ permissions: { read: true } }, async function seekCurrent() { }); Deno.test({ permissions: { read: true } }, function seekSyncCurrent() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); // Deliberately move 1 step forward file.readSync(new Uint8Array(1)); // "H" @@ -626,7 +626,7 @@ Deno.test({ permissions: { read: true } }, function seekSyncCurrent() { }); Deno.test({ permissions: { read: true } }, async function seekEnd() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const seekPosition = -6; // seek from end of file that has 12 chars, 12 - 6 = 6 @@ -640,7 +640,7 @@ Deno.test({ permissions: { read: true } }, async function seekEnd() { }); Deno.test({ permissions: { read: true } }, function seekSyncEnd() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = Deno.openSync(filename); const seekPosition = -6; // seek from end of file that has 12 chars, 12 - 6 = 6 @@ -654,7 +654,7 @@ Deno.test({ permissions: { read: true } }, function seekSyncEnd() { }); Deno.test({ permissions: { read: true } }, async function seekMode() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); await assertRejects( async () => { @@ -747,7 +747,7 @@ Deno.test(async function fileStatSuccess() { }); Deno.test({ permissions: { read: true } }, async function readableStream() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); assert(file.readable instanceof ReadableStream); const chunks = []; @@ -761,7 +761,7 @@ Deno.test({ permissions: { read: true } }, async function readableStream() { Deno.test( { permissions: { read: true } }, async function readableStreamTextEncoderPipe() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const readable = file.readable.pipeThrough(new TextDecoderStream()); const chunks = []; diff --git a/cli/tests/unit/flock_test.ts b/cli/tests/unit/flock_test.ts index fbc061593..7ece1695c 100644 --- a/cli/tests/unit/flock_test.ts +++ b/cli/tests/unit/flock_test.ts @@ -108,7 +108,7 @@ async function checkFirstBlocksSecond(opts: { } function runFlockTestProcess(opts: { exclusive: boolean; sync: boolean }) { - const path = "cli/tests/testdata/fixture.json"; + const path = "cli/tests/testdata/assets/fixture.json"; const scriptText = ` const { rid } = Deno.openSync("${path}"); diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index c7a081bf4..10fed0c47 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -778,7 +778,7 @@ Deno.test({ permissions: { net: true } }, async function whatwgStreams() { Deno.test( { permissions: { read: true } }, async function readableStreamTextEncoderPipe() { - const filename = "cli/tests/testdata/hello.txt"; + const filename = "cli/tests/testdata/assets/hello.txt"; const file = await Deno.open(filename); const readable = file.readable.pipeThrough(new TextDecoderStream()); const chunks = []; diff --git a/cli/tests/unit/read_dir_test.ts b/cli/tests/unit/read_dir_test.ts index fecddd6c4..1c81e860a 100644 --- a/cli/tests/unit/read_dir_test.ts +++ b/cli/tests/unit/read_dir_test.ts @@ -41,10 +41,10 @@ Deno.test({ permissions: { read: false } }, function readDirSyncPerm() { Deno.test({ permissions: { read: true } }, function readDirSyncNotDir() { assertThrows( () => { - Deno.readDirSync("cli/tests/testdata/fixture.json"); + Deno.readDirSync("cli/tests/testdata/assets/fixture.json"); }, Error, - `readdir 'cli/tests/testdata/fixture.json'`, + `readdir 'cli/tests/testdata/assets/fixture.json'`, ); }); diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts index 07935b7fb..c18cdf059 100644 --- a/cli/tests/unit/read_file_test.ts +++ b/cli/tests/unit/read_file_test.ts @@ -9,7 +9,7 @@ import { } from "./test_util.ts"; Deno.test({ permissions: { read: true } }, function readFileSyncSuccess() { - const data = Deno.readFileSync("cli/tests/testdata/fixture.json"); + const data = Deno.readFileSync("cli/tests/testdata/assets/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -19,7 +19,7 @@ Deno.test({ permissions: { read: true } }, function readFileSyncSuccess() { Deno.test({ permissions: { read: true } }, function readFileSyncUrl() { const data = Deno.readFileSync( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); @@ -30,7 +30,7 @@ Deno.test({ permissions: { read: true } }, function readFileSyncUrl() { Deno.test({ permissions: { read: false } }, function readFileSyncPerm() { assertThrows(() => { - Deno.readFileSync("cli/tests/testdata/fixture.json"); + Deno.readFileSync("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); @@ -42,7 +42,7 @@ Deno.test({ permissions: { read: true } }, function readFileSyncNotFound() { Deno.test({ permissions: { read: true } }, async function readFileUrl() { const data = await Deno.readFile( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); @@ -52,7 +52,7 @@ Deno.test({ permissions: { read: true } }, async function readFileUrl() { }); Deno.test({ permissions: { read: true } }, async function readFileSuccess() { - const data = await Deno.readFile("cli/tests/testdata/fixture.json"); + const data = await Deno.readFile("cli/tests/testdata/assets/fixture.json"); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); const json = decoder.decode(data); @@ -62,13 +62,13 @@ Deno.test({ permissions: { read: true } }, async function readFileSuccess() { Deno.test({ permissions: { read: false } }, async function readFilePerm() { await assertRejects(async () => { - await Deno.readFile("cli/tests/testdata/fixture.json"); + await Deno.readFile("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); Deno.test({ permissions: { read: true } }, function readFileSyncLoop() { for (let i = 0; i < 256; i++) { - Deno.readFileSync("cli/tests/testdata/fixture.json"); + Deno.readFileSync("cli/tests/testdata/assets/fixture.json"); } }); @@ -97,7 +97,7 @@ Deno.test( queueMicrotask(() => ac.abort()); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -117,7 +117,7 @@ Deno.test( queueMicrotask(() => ac.abort(abortReason)); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -134,7 +134,7 @@ Deno.test( const ac = new AbortController(); queueMicrotask(() => ac.abort("Some string")); try { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); unreachable(); diff --git a/cli/tests/unit/read_text_file_test.ts b/cli/tests/unit/read_text_file_test.ts index 48d246dad..119c650b6 100644 --- a/cli/tests/unit/read_text_file_test.ts +++ b/cli/tests/unit/read_text_file_test.ts @@ -8,7 +8,7 @@ import { } from "./test_util.ts"; Deno.test({ permissions: { read: true } }, function readTextFileSyncSuccess() { - const data = Deno.readTextFileSync("cli/tests/testdata/fixture.json"); + const data = Deno.readTextFileSync("cli/tests/testdata/assets/fixture.json"); assert(data.length > 0); const pkg = JSON.parse(data); assertEquals(pkg.name, "deno"); @@ -16,7 +16,7 @@ Deno.test({ permissions: { read: true } }, function readTextFileSyncSuccess() { Deno.test({ permissions: { read: true } }, function readTextFileSyncByUrl() { const data = Deno.readTextFileSync( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); @@ -25,7 +25,7 @@ Deno.test({ permissions: { read: true } }, function readTextFileSyncByUrl() { Deno.test({ permissions: { read: false } }, function readTextFileSyncPerm() { assertThrows(() => { - Deno.readTextFileSync("cli/tests/testdata/fixture.json"); + Deno.readTextFileSync("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); @@ -38,7 +38,9 @@ Deno.test({ permissions: { read: true } }, function readTextFileSyncNotFound() { Deno.test( { permissions: { read: true } }, async function readTextFileSuccess() { - const data = await Deno.readTextFile("cli/tests/testdata/fixture.json"); + const data = await Deno.readTextFile( + "cli/tests/testdata/assets/fixture.json", + ); assert(data.length > 0); const pkg = JSON.parse(data); assertEquals(pkg.name, "deno"); @@ -47,7 +49,7 @@ Deno.test( Deno.test({ permissions: { read: true } }, async function readTextFileByUrl() { const data = await Deno.readTextFile( - pathToAbsoluteFileUrl("cli/tests/testdata/fixture.json"), + pathToAbsoluteFileUrl("cli/tests/testdata/assets/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); @@ -56,13 +58,13 @@ Deno.test({ permissions: { read: true } }, async function readTextFileByUrl() { Deno.test({ permissions: { read: false } }, async function readTextFilePerm() { await assertRejects(async () => { - await Deno.readTextFile("cli/tests/testdata/fixture.json"); + await Deno.readTextFile("cli/tests/testdata/assets/fixture.json"); }, Deno.errors.PermissionDenied); }); Deno.test({ permissions: { read: true } }, function readTextFileSyncLoop() { for (let i = 0; i < 256; i++) { - Deno.readTextFileSync("cli/tests/testdata/fixture.json"); + Deno.readTextFileSync("cli/tests/testdata/assets/fixture.json"); } }); @@ -91,7 +93,7 @@ Deno.test( queueMicrotask(() => ac.abort()); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -111,7 +113,7 @@ Deno.test( queueMicrotask(() => ac.abort(abortReason)); await assertRejects( async () => { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); }, @@ -128,7 +130,7 @@ Deno.test( const ac = new AbortController(); queueMicrotask(() => ac.abort("Some string")); try { - await Deno.readFile("cli/tests/testdata/fixture.json", { + await Deno.readFile("cli/tests/testdata/assets/fixture.json", { signal: ac.signal, }); unreachable(); diff --git a/cli/tests/unit/real_path_test.ts b/cli/tests/unit/real_path_test.ts index 2dfb5d214..5297c2b76 100644 --- a/cli/tests/unit/real_path_test.ts +++ b/cli/tests/unit/real_path_test.ts @@ -9,7 +9,7 @@ import { } from "./test_util.ts"; Deno.test({ permissions: { read: true } }, function realPathSyncSuccess() { - const relative = "cli/tests/testdata/fixture.json"; + const relative = "cli/tests/testdata/assets/fixture.json"; const realPath = Deno.realPathSync(relative); if (Deno.build.os !== "windows") { assert(realPath.startsWith("/")); @@ -21,7 +21,7 @@ Deno.test({ permissions: { read: true } }, function realPathSyncSuccess() { }); Deno.test({ permissions: { read: true } }, function realPathSyncUrl() { - const relative = "cli/tests/testdata/fixture.json"; + const relative = "cli/tests/testdata/assets/fixture.json"; const url = pathToAbsoluteFileUrl(relative); assertEquals(Deno.realPathSync(relative), Deno.realPathSync(url)); }); @@ -60,7 +60,7 @@ Deno.test({ permissions: { read: true } }, function realPathSyncNotFound() { }); Deno.test({ permissions: { read: true } }, async function realPathSuccess() { - const relativePath = "cli/tests/testdata/fixture.json"; + const relativePath = "cli/tests/testdata/assets/fixture.json"; const realPath = await Deno.realPath(relativePath); if (Deno.build.os !== "windows") { assert(realPath.startsWith("/")); @@ -74,7 +74,7 @@ Deno.test({ permissions: { read: true } }, async function realPathSuccess() { Deno.test( { permissions: { read: true } }, async function realPathUrl() { - const relative = "cli/tests/testdata/fixture.json"; + const relative = "cli/tests/testdata/assets/fixture.json"; const url = pathToAbsoluteFileUrl(relative); assertEquals(await Deno.realPath(relative), await Deno.realPath(url)); }, diff --git a/cli/tests/unit/resources_test.ts b/cli/tests/unit/resources_test.ts index 08fbfafc4..60325b91d 100644 --- a/cli/tests/unit/resources_test.ts +++ b/cli/tests/unit/resources_test.ts @@ -37,7 +37,7 @@ Deno.test({ permissions: { net: true } }, async function resourcesNet() { Deno.test({ permissions: { read: true } }, async function resourcesFile() { const resourcesBefore = Deno.resources(); - const f = await Deno.open("cli/tests/testdata/hello.txt"); + const f = await Deno.open("cli/tests/testdata/assets/hello.txt"); const resourcesAfter = Deno.resources(); f.close(); diff --git a/cli/tests/unit/stat_test.ts b/cli/tests/unit/stat_test.ts index f39b3be2c..9a504b4fc 100644 --- a/cli/tests/unit/stat_test.ts +++ b/cli/tests/unit/stat_test.ts @@ -146,7 +146,7 @@ Deno.test({ permissions: { read: true } }, function lstatSyncSuccess() { Deno.test({ permissions: { read: false } }, function lstatSyncPerm() { assertThrows(() => { - Deno.lstatSync("hello.txt"); + Deno.lstatSync("assets/hello.txt"); }, Deno.errors.PermissionDenied); }); diff --git a/cli/tests/unit/tty_test.ts b/cli/tests/unit/tty_test.ts index 9feacdf51..e50443aab 100644 --- a/cli/tests/unit/tty_test.ts +++ b/cli/tests/unit/tty_test.ts @@ -4,7 +4,7 @@ import { assert, assertThrows } from "./test_util.ts"; // Note tests for Deno.setRaw is in integration tests. Deno.test({ permissions: { read: true } }, function consoleSizeFile() { - const file = Deno.openSync("cli/tests/testdata/hello.txt"); + const file = Deno.openSync("cli/tests/testdata/assets/hello.txt"); assertThrows(() => { Deno.consoleSize(file.rid); }, Error); @@ -20,7 +20,7 @@ Deno.test(function consoleSizeError() { Deno.test({ permissions: { read: true } }, function isatty() { // CI not under TTY, so cannot test stdin/stdout/stderr. - const f = Deno.openSync("cli/tests/testdata/hello.txt"); + const f = Deno.openSync("cli/tests/testdata/assets/hello.txt"); assert(!Deno.isatty(f.rid)); f.close(); }); diff --git a/cli/tests/unit/wasm_test.ts b/cli/tests/unit/wasm_test.ts index 2bf0a7480..03ed0e298 100644 --- a/cli/tests/unit/wasm_test.ts +++ b/cli/tests/unit/wasm_test.ts @@ -79,7 +79,7 @@ Deno.test(async function wasmInstantiateStreaming() { Deno.test( { permissions: { read: true } }, async function wasmFileStreaming() { - const url = import.meta.resolve("../testdata/unreachable.wasm"); + const url = import.meta.resolve("../testdata/assets/unreachable.wasm"); assert(url.startsWith("file://")); const { module } = await WebAssembly.instantiateStreaming(fetch(url)); @@ -96,7 +96,7 @@ Deno.test( // deno-dom's WASM file is a real-world non-trivial case that gave us // trouble when implementing this. await WebAssembly.instantiateStreaming(fetch( - "http://localhost:4545/deno_dom_0.1.3-alpha2.wasm", + "http://localhost:4545/assets/deno_dom_0.1.3-alpha2.wasm", )); }, ); diff --git a/cli/tests/unit/webgpu_test.ts b/cli/tests/unit/webgpu_test.ts index fa71ffcc8..c903736f8 100644 --- a/cli/tests/unit/webgpu_test.ts +++ b/cli/tests/unit/webgpu_test.ts @@ -27,7 +27,7 @@ Deno.test({ assert(device); const shaderCode = await Deno.readTextFile( - "cli/tests/testdata/webgpu_computepass_shader.wgsl", + "cli/tests/testdata/webgpu/computepass_shader.wgsl", ); const shaderModule = device.createShaderModule({ @@ -116,7 +116,7 @@ Deno.test({ assert(device); const shaderCode = await Deno.readTextFile( - "cli/tests/testdata/webgpu_hellotriangle_shader.wgsl", + "cli/tests/testdata/webgpu/hellotriangle_shader.wgsl", ); const shaderModule = device.createShaderModule({ @@ -202,7 +202,7 @@ Deno.test({ assertEquals( data, - await Deno.readFile("cli/tests/testdata/webgpu_hellotriangle.out"), + await Deno.readFile("cli/tests/testdata/webgpu/hellotriangle.out"), ); outputBuffer.unmap(); |