diff options
Diffstat (limited to 'cli/tests')
99 files changed, 682 insertions, 668 deletions
diff --git a/cli/tests/019_media_types.ts b/cli/tests/019_media_types.ts index cc99be83b..523639be4 100644 --- a/cli/tests/019_media_types.ts +++ b/cli/tests/019_media_types.ts @@ -20,5 +20,5 @@ console.log( loadedJs1, loadedJs2, loadedJs3, - loadedJs4 + loadedJs4, ); diff --git a/cli/tests/042_dyn_import_evalcontext.ts b/cli/tests/042_dyn_import_evalcontext.ts index e1cc485d1..f31fffee9 100644 --- a/cli/tests/042_dyn_import_evalcontext.ts +++ b/cli/tests/042_dyn_import_evalcontext.ts @@ -1,4 +1,4 @@ // @ts-expect-error Deno.core.evalContext( - "(async () => console.log(await import('./subdir/mod4.js')))()" + "(async () => console.log(await import('./subdir/mod4.js')))()", ); diff --git a/cli/tests/046_jsx_test.tsx b/cli/tests/046_jsx_test.tsx index a3df2aad7..857d24d36 100644 --- a/cli/tests/046_jsx_test.tsx +++ b/cli/tests/046_jsx_test.tsx @@ -5,10 +5,10 @@ declare namespace JSX { } const React = { createElement(factory: any, props: any, ...children: any[]) { - return {factory, props, children} - } -} + return { factory, props, children }; + }, +}; const View = () => ( <div class="deno">land</div> -) -console.log(<View />) +); +console.log(<View />); diff --git a/cli/tests/047_jsx_test.jsx b/cli/tests/047_jsx_test.jsx index 553c4c5a5..61bd7e36c 100644 --- a/cli/tests/047_jsx_test.jsx +++ b/cli/tests/047_jsx_test.jsx @@ -1,9 +1,9 @@ const React = { createElement(factory, props, ...children) { - return {factory, props, children} - } -} + return { factory, props, children }; + }, +}; const View = () => ( <div class="deno">land</div> -) -console.log(<View />) +); +console.log(<View />); diff --git a/cli/tests/048_media_types_jsx.ts b/cli/tests/048_media_types_jsx.ts index f6a498fdf..54ed28e17 100644 --- a/cli/tests/048_media_types_jsx.ts +++ b/cli/tests/048_media_types_jsx.ts @@ -29,5 +29,5 @@ console.log( loadedJsx1, loadedJsx2, loadedJsx3, - loadedJsx4 + loadedJsx4, ); diff --git a/cli/tests/053_import_compression/main.ts b/cli/tests/053_import_compression/main.ts index d18363b7d..5b2199483 100644 --- a/cli/tests/053_import_compression/main.ts +++ b/cli/tests/053_import_compression/main.ts @@ -3,11 +3,11 @@ import "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli"; console.log( await fetch( - "http://127.0.0.1:4545/cli/tests/053_import_compression/gziped" - ).then((res) => res.text()) + "http://127.0.0.1:4545/cli/tests/053_import_compression/gziped", + ).then((res) => res.text()), ); console.log( await fetch( - "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli" - ).then((res) => res.text()) + "http://127.0.0.1:4545/cli/tests/053_import_compression/brotli", + ).then((res) => res.text()), ); diff --git a/cli/tests/Component.tsx b/cli/tests/Component.tsx index 34208329b..81dfd6957 100644 --- a/cli/tests/Component.tsx +++ b/cli/tests/Component.tsx @@ -1 +1 @@ -import "./046_jsx_test.tsx";
\ No newline at end of file +import "./046_jsx_test.tsx"; diff --git a/cli/tests/badly_formatted.js b/cli/tests/badly_formatted.js deleted file mode 100644 index b646a95a3..000000000 --- a/cli/tests/badly_formatted.js +++ /dev/null @@ -1,4 +0,0 @@ - -console.log("Hello World" - -) diff --git a/cli/tests/badly_formatted.mjs b/cli/tests/badly_formatted.mjs new file mode 100644 index 000000000..bc515a330 --- /dev/null +++ b/cli/tests/badly_formatted.mjs @@ -0,0 +1,4 @@ +// Deliberately using .mjs to avoid triggering dprint +console.log("Hello World" + +) diff --git a/cli/tests/badly_formatted_fixed.js b/cli/tests/badly_formatted_fixed.js index accefceba..e9062ba85 100644 --- a/cli/tests/badly_formatted_fixed.js +++ b/cli/tests/badly_formatted_fixed.js @@ -1 +1,2 @@ +// Deliberately using .mjs to avoid triggering dprint console.log("Hello World"); diff --git a/cli/tests/cafile_info.ts b/cli/tests/cafile_info.ts index e11d106e6..cd92a42f6 100644 --- a/cli/tests/cafile_info.ts +++ b/cli/tests/cafile_info.ts @@ -20,5 +20,5 @@ console.log( loadedJs1, loadedJs2, loadedJs3, - loadedJs4 + loadedJs4, ); diff --git a/cli/tests/compiler_api_test.ts b/cli/tests/compiler_api_test.ts index 274f1b98d..7ff9ebc2b 100644 --- a/cli/tests/compiler_api_test.ts +++ b/cli/tests/compiler_api_test.ts @@ -43,7 +43,7 @@ Deno.test({ { module: "amd", sourceMap: false, - } + }, ); assert(diagnostics == null); assert(actual); @@ -63,7 +63,7 @@ Deno.test({ }, { lib: ["dom", "es2018", "deno.ns"], - } + }, ); assert(diagnostics == null); assert(actual); @@ -81,7 +81,7 @@ Deno.test({ }, { types: ["./subdir/foo_types.d.ts"], - } + }, ); assert(diagnostics == null); assert(actual); @@ -112,7 +112,7 @@ Deno.test({ { sourceMap: false, module: "amd", - } + }, ); assert(actual); assertEquals(Object.keys(actual), ["foo.ts"]); @@ -155,7 +155,7 @@ Deno.test({ }, { removeComments: true, - } + }, ); assert(diagnostics == null); assert(!actual.includes(`random`)); @@ -182,7 +182,7 @@ Deno.test({ { "/foo.ts": `console.log("hello world!")\n`, }, - { target: "es2015" } + { target: "es2015" }, ); assert(diagnostics == null); assert(actual.includes(`var __awaiter = `)); diff --git a/cli/tests/echo_server.ts b/cli/tests/echo_server.ts index deab17397..053bdf5c1 100644 --- a/cli/tests/echo_server.ts +++ b/cli/tests/echo_server.ts @@ -7,5 +7,5 @@ listener.accept().then( await Deno.copy(conn, conn); conn.close(); listener.close(); - } + }, ); diff --git a/cli/tests/error_014_catch_dynamic_import_error.js b/cli/tests/error_014_catch_dynamic_import_error.js index ad3735fc3..483be7b1a 100644 --- a/cli/tests/error_014_catch_dynamic_import_error.js +++ b/cli/tests/error_014_catch_dynamic_import_error.js @@ -24,7 +24,7 @@ await import("./subdir/indirect_throws.js"); } catch (err) { console.log( - "Caught error thrown indirectly by dynamically imported module." + "Caught error thrown indirectly by dynamically imported module.", ); console.log(err); } diff --git a/cli/tests/error_017_hide_long_source_ts.ts b/cli/tests/error_017_hide_long_source_ts.ts index a4c30670f..d61cb1277 100644 --- a/cli/tests/error_017_hide_long_source_ts.ts +++ b/cli/tests/error_017_hide_long_source_ts.ts @@ -1,2 +1,3 @@ +// deno-fmt-ignore-file const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/error_017_hide_long_source_ts.ts.out b/cli/tests/error_017_hide_long_source_ts.ts.out index 6799a94cc..52c2f7cc2 100644 --- a/cli/tests/error_017_hide_long_source_ts.ts.out +++ b/cli/tests/error_017_hide_long_source_ts.ts.out @@ -1,3 +1,3 @@ [WILDCARD] error: TS2532 [ERROR]: Object is possibly 'undefined'. - at [WILDCARD]tests/error_017_hide_long_source_ts.ts:2:1 + at [WILDCARD]tests/error_017_hide_long_source_ts.ts:3:1 diff --git a/cli/tests/error_018_hide_long_source_js.js b/cli/tests/error_018_hide_long_source_js.js index a4c30670f..d61cb1277 100644 --- a/cli/tests/error_018_hide_long_source_js.js +++ b/cli/tests/error_018_hide_long_source_js.js @@ -1,2 +1,3 @@ +// deno-fmt-ignore-file const LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG = undefined; LONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONGLONG.a; diff --git a/cli/tests/error_018_hide_long_source_js.js.out b/cli/tests/error_018_hide_long_source_js.js.out index 37265d659..750ddec4e 100644 --- a/cli/tests/error_018_hide_long_source_js.js.out +++ b/cli/tests/error_018_hide_long_source_js.js.out @@ -1,2 +1,2 @@ error: Uncaught TypeError: Cannot read property 'a' of undefined - at file:///[WILDCARD]cli/tests/error_018_hide_long_source_js.js:2:206 + at file:///[WILDCARD]cli/tests/error_018_hide_long_source_js.js:3:206 diff --git a/cli/tests/error_syntax.js b/cli/tests/error_syntax.js index 0c0c09855..c0414c356 100644 --- a/cli/tests/error_syntax.js +++ b/cli/tests/error_syntax.js @@ -1,3 +1,3 @@ -// prettier-ignore +// deno-fmt-ignore-file (the following is a syntax error ^^ ! ) diff --git a/cli/tests/error_syntax_empty_trailing_line.mjs b/cli/tests/error_syntax_empty_trailing_line.mjs index 5bc6b1c23..864dfb0c7 100644 --- a/cli/tests/error_syntax_empty_trailing_line.mjs +++ b/cli/tests/error_syntax_empty_trailing_line.mjs @@ -1,2 +1,2 @@ -// Deliberately using .mjs to avoid triggering prettier +// Deliberately using .mjs to avoid triggering dprint setTimeout(() => {}), diff --git a/cli/tests/integration_tests.rs b/cli/tests/integration_tests.rs index e93edc79f..4df7a8268 100644 --- a/cli/tests/integration_tests.rs +++ b/cli/tests/integration_tests.rs @@ -347,7 +347,7 @@ fn fmt_test() { let t = TempDir::new().expect("tempdir fail"); let fixed = util::root_path().join("cli/tests/badly_formatted_fixed.js"); let badly_formatted_original = - util::root_path().join("cli/tests/badly_formatted.js"); + util::root_path().join("cli/tests/badly_formatted.mjs"); let badly_formatted = t.path().join("badly_formatted.js"); let badly_formatted_str = badly_formatted.to_str().unwrap(); std::fs::copy(&badly_formatted_original, &badly_formatted) diff --git a/cli/tests/jsx_import_from_ts.App.jsx b/cli/tests/jsx_import_from_ts.App.jsx index 6ea58436b..649230613 100644 --- a/cli/tests/jsx_import_from_ts.App.jsx +++ b/cli/tests/jsx_import_from_ts.App.jsx @@ -1,11 +1,11 @@ const React = { - createElement() {} -} + createElement() {}, +}; export default function app() { - return ( - <div> - <h2>asdf</h2> - </div> - ); -}
\ No newline at end of file + return ( + <div> + <h2>asdf</h2> + </div> + ); +} diff --git a/cli/tests/lib_ref.ts b/cli/tests/lib_ref.ts index 1b9f243c8..0a4ce3fc7 100644 --- a/cli/tests/lib_ref.ts +++ b/cli/tests/lib_ref.ts @@ -1,12 +1,13 @@ const [errors, program] = await Deno.compile( "main.ts", { - "main.ts": `/// <reference lib="dom" />\n\ndocument.getElementById("foo");\nDeno.args;`, + "main.ts": + `/// <reference lib="dom" />\n\ndocument.getElementById("foo");\nDeno.args;`, }, { target: "es2018", lib: ["es2018", "deno.ns"], - } + }, ); console.log(errors); diff --git a/cli/tests/lib_runtime_api.ts b/cli/tests/lib_runtime_api.ts index 5d76ea1c5..788288f72 100644 --- a/cli/tests/lib_runtime_api.ts +++ b/cli/tests/lib_runtime_api.ts @@ -5,7 +5,7 @@ const [errors, program] = await Deno.compile( }, { lib: ["dom", "esnext"], - } + }, ); console.log(errors); diff --git a/cli/tests/subdir/fetching_worker.js b/cli/tests/subdir/fetching_worker.js index a4237a97a..3e33d1c9e 100644 --- a/cli/tests/subdir/fetching_worker.js +++ b/cli/tests/subdir/fetching_worker.js @@ -1,5 +1,5 @@ const r = await fetch( - "http://localhost:4545/cli/tests/subdir/fetching_worker.js" + "http://localhost:4545/cli/tests/subdir/fetching_worker.js", ); await r.text(); postMessage("Done!"); diff --git a/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx b/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx +++ b/cli/tests/subdir/mt_application_ecmascript_jsx.j2.jsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx b/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx +++ b/cli/tests/subdir/mt_application_x_javascript_jsx.j4.jsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx b/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx +++ b/cli/tests/subdir/mt_application_x_typescript_tsx.t4.tsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_javascript_jsx.jsx b/cli/tests/subdir/mt_javascript_jsx.jsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_javascript_jsx.jsx +++ b/cli/tests/subdir/mt_javascript_jsx.jsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx b/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx +++ b/cli/tests/subdir/mt_text_ecmascript_jsx.j3.jsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx b/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx +++ b/cli/tests/subdir/mt_text_javascript_jsx.j1.jsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx b/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx +++ b/cli/tests/subdir/mt_text_typescript_tsx.t1.tsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx b/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx +++ b/cli/tests/subdir/mt_video_mp2t_tsx.t3.tsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx b/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx index 2c7a15491..c5c27f9f9 100644 --- a/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx +++ b/cli/tests/subdir/mt_video_vdn_tsx.t2.tsx @@ -1,5 +1,5 @@ const React = { - createElement() {} -} + createElement() {}, +}; const temp = <div></div>; export const loaded = true; diff --git a/cli/tests/subdir/nested_worker.js b/cli/tests/subdir/nested_worker.js index d3801b8c5..4b51b8763 100644 --- a/cli/tests/subdir/nested_worker.js +++ b/cli/tests/subdir/nested_worker.js @@ -1,7 +1,7 @@ // Specifier should be resolved relative to current file const jsWorker = new Worker( new URL("sibling_worker.js", import.meta.url).href, - { type: "module", name: "sibling" } + { type: "module", name: "sibling" }, ); jsWorker.onerror = (_e) => { diff --git a/cli/tests/swc_syntax_error.ts b/cli/tests/swc_syntax_error.ts index 70e0de97d..991ca9214 100644 --- a/cli/tests/swc_syntax_error.ts +++ b/cli/tests/swc_syntax_error.ts @@ -1,3 +1,4 @@ +// deno-fmt-ignore-file for await (const req of s) { let something: } diff --git a/cli/tests/swc_syntax_error.ts.out b/cli/tests/swc_syntax_error.ts.out index 0896faf68..0cc365e20 100644 --- a/cli/tests/swc_syntax_error.ts.out +++ b/cli/tests/swc_syntax_error.ts.out @@ -1 +1 @@ -error: Unexpected token Some(RBrace) at [WILDCARD]syntax_error.ts:3:0 +error: Unexpected token Some(RBrace) at [WILDCARD]syntax_error.ts:4:0 diff --git a/cli/tests/top_level_for_await.js b/cli/tests/top_level_for_await.js index 54742ce52..a330f6c71 100644 --- a/cli/tests/top_level_for_await.js +++ b/cli/tests/top_level_for_await.js @@ -7,4 +7,4 @@ function* asyncGenerator() { for await (const num of asyncGenerator()) { console.log(num); -}; +} diff --git a/cli/tests/unit/body_test.ts b/cli/tests/unit/body_test.ts index ac65a1312..b7393ad0d 100644 --- a/cli/tests/unit/body_test.ts +++ b/cli/tests/unit/body_test.ts @@ -37,7 +37,7 @@ unitTest( { perms: { net: true } }, async function bodyMultipartFormData(): Promise<void> { const response = await fetch( - "http://localhost:4545/multipart_form_data.txt" + "http://localhost:4545/multipart_form_data.txt", ); const text = await response.text(); @@ -47,14 +47,14 @@ unitTest( assert(formData.has("field_1")); assertEquals(formData.get("field_1")!.toString(), "value_1 \r\n"); assert(formData.has("field_2")); - } + }, ); unitTest( { perms: { net: true } }, async function bodyURLEncodedFormData(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt" + "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt", ); const text = await response.text(); @@ -65,7 +65,7 @@ unitTest( assertEquals(formData.get("field_1")!.toString(), "Hi"); assert(formData.has("field_2")); assertEquals(formData.get("field_2")!.toString(), "<Deno>"); - } + }, ); unitTest({ perms: {} }, async function bodyURLSearchParams(): Promise<void> { diff --git a/cli/tests/unit/buffer_test.ts b/cli/tests/unit/buffer_test.ts index fdbadbfe4..7a628cae5 100644 --- a/cli/tests/unit/buffer_test.ts +++ b/cli/tests/unit/buffer_test.ts @@ -46,7 +46,7 @@ async function fillBytes( buf: Deno.Buffer, s: string, n: number, - fub: Uint8Array + fub: Uint8Array, ): Promise<string> { check(buf, s); for (; n > 0; n--) { @@ -64,7 +64,7 @@ async function fillBytes( async function empty( buf: Deno.Buffer, s: string, - fub: Uint8Array + fub: Uint8Array, ): Promise<void> { check(buf, s); while (true) { @@ -166,7 +166,7 @@ unitTest(async function bufferTooLargeByteWrites(): Promise<void> { buf.grow(growLen); }, Error, - "grown beyond the maximum size" + "grown beyond the maximum size", ); }); @@ -179,8 +179,9 @@ unitTest( let written = 0; const buf = new Deno.Buffer(); const writes = Math.floor(capacity / bufSize); - for (let i = 0; i < writes; i++) + for (let i = 0; i < writes; i++) { written += buf.writeSync(repeat("x", bufSize)); + } if (written < capacity) { written += buf.writeSync(repeat("x", capacity - written)); @@ -188,7 +189,7 @@ unitTest( assertEquals(written, capacity); } - } + }, ); unitTest( @@ -202,9 +203,9 @@ unitTest( await buf.readFrom(reader); }, Error, - "grown beyond the maximum size" + "grown beyond the maximum size", ); - } + }, ); unitTest( @@ -218,9 +219,9 @@ unitTest( buf.readFromSync(reader); }, Error, - "grown beyond the maximum size" + "grown beyond the maximum size", ); - } + }, ); unitTest( @@ -234,7 +235,7 @@ unitTest( assertEquals(buf.length, capacity); } - } + }, ); unitTest( @@ -247,7 +248,7 @@ unitTest( await buf.readFrom(reader); assertEquals(buf.length, capacity); } - } + }, ); unitTest( @@ -261,7 +262,7 @@ unitTest( await buf.readFrom(reader); assertEquals(buf.length, capacity); } - } + }, ); unitTest(async function bufferLargeByteReads(): Promise<void> { @@ -292,7 +293,7 @@ unitTest(async function bufferReadFrom(): Promise<void> { buf, "", 5, - testBytes.subarray(0, Math.floor(testBytes.byteLength / i)) + testBytes.subarray(0, Math.floor(testBytes.byteLength / i)), ); const b = new Deno.Buffer(); await b.readFrom(buf); @@ -314,7 +315,7 @@ unitTest(async function bufferReadFromSync(): Promise<void> { buf, "", 5, - testBytes.subarray(0, Math.floor(testBytes.byteLength / i)) + testBytes.subarray(0, Math.floor(testBytes.byteLength / i)), ); const b = new Deno.Buffer(); b.readFromSync(buf); @@ -340,11 +341,11 @@ unitTest(async function bufferTestGrow(): Promise<void> { // Check that buffer has correct data. assertEquals( buf.bytes().subarray(0, startLen - nread), - xBytes.subarray(nread) + xBytes.subarray(nread), ); assertEquals( buf.bytes().subarray(startLen - nread, startLen - nread + growLen), - yBytes + yBytes, ); } } diff --git a/cli/tests/unit/chmod_test.ts b/cli/tests/unit/chmod_test.ts index 5a2afd507..c53fe8c8b 100644 --- a/cli/tests/unit/chmod_test.ts +++ b/cli/tests/unit/chmod_test.ts @@ -21,7 +21,7 @@ unitTest( const fileInfo = Deno.statSync(filename); assert(fileInfo.mode); assertEquals(fileInfo.mode & 0o777, 0o777); - } + }, ); unitTest( @@ -40,7 +40,7 @@ unitTest( assertEquals(fileInfo.mode & 0o777, 0o777); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); // Check symlink when not on windows @@ -72,7 +72,7 @@ unitTest( symlinkInfo = Deno.lstatSync(symlinkName); assert(symlinkInfo.mode); assertEquals(symlinkInfo.mode & 0o777, symlinkMode); - } + }, ); unitTest({ perms: { write: true } }, function chmodSyncFailure(): void { @@ -102,7 +102,7 @@ unitTest( const fileInfo = Deno.statSync(filename); assert(fileInfo.mode); assertEquals(fileInfo.mode & 0o777, 0o777); - } + }, ); unitTest( @@ -121,7 +121,7 @@ unitTest( assertEquals(fileInfo.mode & 0o777, 0o777); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); // Check symlink when not on windows @@ -154,7 +154,7 @@ unitTest( symlinkInfo = Deno.lstatSync(symlinkName); assert(symlinkInfo.mode); assertEquals(symlinkInfo.mode & 0o777, symlinkMode); - } + }, ); unitTest({ perms: { write: true } }, async function chmodFailure(): Promise< diff --git a/cli/tests/unit/chown_test.ts b/cli/tests/unit/chown_test.ts index 163bfa48b..739e355de 100644 --- a/cli/tests/unit/chown_test.ts +++ b/cli/tests/unit/chown_test.ts @@ -33,7 +33,7 @@ unitTest( } catch (e) { assert(e instanceof Deno.errors.PermissionDenied); } - } + }, ); unitTest( @@ -47,7 +47,7 @@ unitTest( } catch (e) { assert(e instanceof Deno.errors.NotFound); } - } + }, ); unitTest( @@ -61,7 +61,7 @@ unitTest( } catch (e) { assert(e instanceof Deno.errors.NotFound); } - } + }, ); unitTest( @@ -78,7 +78,7 @@ unitTest( assert(e instanceof Deno.errors.PermissionDenied); } Deno.removeSync(dirPath, { recursive: true }); - } + }, ); unitTest( @@ -95,7 +95,7 @@ unitTest( assert(e instanceof Deno.errors.PermissionDenied); } await Deno.remove(dirPath, { recursive: true }); - } + }, ); unitTest( @@ -115,7 +115,7 @@ unitTest( Deno.chownSync(filePath, uid, gid); Deno.removeSync(dirPath, { recursive: true }); - } + }, ); unitTest( @@ -127,7 +127,7 @@ unitTest( Deno.writeTextFileSync(fileUrl, "Hello"); Deno.chownSync(fileUrl, uid, gid); Deno.removeSync(dirPath, { recursive: true }); - } + }, ); unitTest( @@ -139,7 +139,7 @@ unitTest( await Deno.writeTextFile(filePath, "Hello"); await Deno.chown(filePath, uid, gid); Deno.removeSync(dirPath, { recursive: true }); - } + }, ); unitTest( @@ -151,7 +151,7 @@ unitTest( await Deno.writeTextFile(filePath, "Foo"); await Deno.chown(filePath, uid, null); Deno.removeSync(dirPath, { recursive: true }); - } + }, ); unitTest( @@ -171,5 +171,5 @@ unitTest( await Deno.chown(fileUrl, uid, gid); Deno.removeSync(dirPath, { recursive: true }); - } + }, ); diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 7a03cd6b6..bc97107b1 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -155,7 +155,7 @@ unitTest(function consoleTestStringifyCircular(): void { assertEquals(stringify(/[0-9]*/), "/[0-9]*/"); assertEquals( stringify(new Date("2018-12-10T02:26:59.002Z")), - "2018-12-10T02:26:59.002Z" + "2018-12-10T02:26:59.002Z", ); assertEquals(stringify(new Set([1, 2, 3])), "Set { 1, 2, 3 }"); assertEquals( @@ -163,9 +163,9 @@ unitTest(function consoleTestStringifyCircular(): void { new Map([ [1, "one"], [2, "two"], - ]) + ]), ), - `Map { 1 => "one", 2 => "two" }` + `Map { 1 => "one", 2 => "two" }`, ); assertEquals(stringify(new WeakSet()), "WeakSet { [items unknown] }"); assertEquals(stringify(new WeakMap()), "WeakMap { [items unknown] }"); @@ -175,28 +175,28 @@ unitTest(function consoleTestStringifyCircular(): void { assertEquals(stringify(new Extended()), "Extended { a: 1, b: 2 }"); assertEquals( stringify(function f(): void {}), - "[Function: f]" + "[Function: f]", ); assertEquals( stringify(async function af(): Promise<void> {}), - "[AsyncFunction: af]" + "[AsyncFunction: af]", ); assertEquals( stringify(function* gf() {}), - "[GeneratorFunction: gf]" + "[GeneratorFunction: gf]", ); assertEquals( stringify(async function* agf() {}), - "[AsyncGeneratorFunction: agf]" + "[AsyncGeneratorFunction: agf]", ); assertEquals( stringify(new Uint8Array([1, 2, 3])), - "Uint8Array(3) [ 1, 2, 3 ]" + "Uint8Array(3) [ 1, 2, 3 ]", ); assertEquals(stringify(Uint8Array.prototype), "TypedArray {}"); assertEquals( stringify({ a: { b: { c: { d: new Set([1]) } } } }), - "{ a: { b: { c: { d: [Set] } } } }" + "{ a: { b: { c: { d: [Set] } } } }", ); assertEquals(stringify(nestedObj), nestedObjExpected); assertEquals(stringify(JSON), 'JSON { Symbol(Symbol.toStringTag): "JSON" }'); @@ -224,11 +224,11 @@ unitTest(function consoleTestStringifyCircular(): void { trace: [Function], indentLevel: 0, Symbol(isConsoleInstance): true -}` +}`, ); assertEquals( stringify({ str: 1, [Symbol.for("sym")]: 2, [Symbol.toStringTag]: "TAG" }), - 'TAG { str: 1, Symbol(sym): 2, Symbol(Symbol.toStringTag): "TAG" }' + 'TAG { str: 1, Symbol(sym): 2, Symbol(Symbol.toStringTag): "TAG" }', ); // test inspect is working the same assertEquals(stripColor(Deno.inspect(nestedObj)), nestedObjExpected); @@ -240,21 +240,21 @@ unitTest(function consoleTestStringifyWithDepth(): void { const nestedObj: any = { a: { b: { c: { d: { e: { f: 42 } } } } } }; assertEquals( stripColor(inspectArgs([nestedObj], { depth: 3 })), - "{ a: { b: { c: [Object] } } }" + "{ a: { b: { c: [Object] } } }", ); assertEquals( stripColor(inspectArgs([nestedObj], { depth: 4 })), - "{ a: { b: { c: { d: [Object] } } } }" + "{ a: { b: { c: { d: [Object] } } } }", ); assertEquals(stripColor(inspectArgs([nestedObj], { depth: 0 })), "[Object]"); assertEquals( stripColor(inspectArgs([nestedObj])), - "{ a: { b: { c: { d: [Object] } } } }" + "{ a: { b: { c: { d: [Object] } } } }", ); // test inspect is working the same way assertEquals( stripColor(Deno.inspect(nestedObj, { depth: 4 })), - "{ a: { b: { c: { d: [Object] } } } }" + "{ a: { b: { c: { d: [Object] } } } }", ); }); @@ -290,7 +290,7 @@ unitTest(function consoleTestStringifyLargeObject(): void { asda: 3, x: { a: "asd", x: 3 } } -}` +}`, ); }); @@ -310,7 +310,7 @@ unitTest(function consoleTestStringifyIterable() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... 100 more items -]` +]`, ); const obj = { a: "a", longArray }; @@ -328,7 +328,7 @@ unitTest(function consoleTestStringifyIterable() { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ... 100 more items ] -}` +}`, ); const shortMap = new Map([ @@ -445,7 +445,7 @@ unitTest(function consoleTestStringifyIterable() { "98" => 98, "99" => 99, ... 100 more items -}` +}`, ); const shortSet = new Set([1, 2, 3]); @@ -558,14 +558,14 @@ unitTest(function consoleTestStringifyIterable() { 98, 99, ... 100 more items -}` +}`, ); const withEmptyEl = Array(10); withEmptyEl.fill(0, 4, 6); assertEquals( stringify(withEmptyEl), - `[ <4 empty items>, 0, 0, <4 empty items> ]` + `[ <4 empty items>, 0, 0, <4 empty items> ]`, ); /* TODO(ry) Fix this test @@ -643,7 +643,7 @@ unitTest(function consoleTestWithCustomInspectorError(): void { assertEquals(stringify(new B({ a: "a" })), "a"); assertEquals( stringify(B.prototype), - "{ Symbol(Deno.customInspect): [Function: [Deno.customInspect]] }" + "{ Symbol(Deno.customInspect): [Function: [Deno.customInspect]] }", ); }); @@ -662,7 +662,7 @@ unitTest(function consoleTestWithIntegerFormatSpecifier(): void { assertEquals(stringify("%d", 12345678901234567890123), "1"); assertEquals( stringify("%i", 12345678901234567890123n), - "12345678901234567890123n" + "12345678901234567890123n", ); }); @@ -701,7 +701,7 @@ unitTest(function consoleTestWithObjectFormatSpecifier(): void { assertEquals(stringify("%o", { a: 42 }), "{ a: 42 }"); assertEquals( stringify("%o", { a: { b: { c: { d: new Set([1]) } } } }), - "{ a: { b: { c: { d: [Set] } } } }" + "{ a: { b: { c: { d: [Set] } } } }", ); }); @@ -749,7 +749,7 @@ unitTest(function consoleTestError(): void { assert( stringify(e) .split("\n")[0] // error has been caught - .includes("MyError: This is an error") + .includes("MyError: This is an error"), ); } }); @@ -816,7 +816,7 @@ type ConsoleExamineFunc = ( csl: any, out: StringBuffer, err?: StringBuffer, - both?: StringBuffer + both?: StringBuffer, ) => void; function mockConsole(f: ConsoleExamineFunc): void { @@ -829,7 +829,7 @@ function mockConsole(f: ConsoleExamineFunc): void { const buf = isErr ? err : out; buf.add(content); both.add(content); - } + }, ); f(csl, out, err, both); } @@ -854,7 +854,7 @@ unitTest(function consoleGroup(): void { 4 5 6 -` +`, ); }); }); @@ -884,7 +884,7 @@ unitTest(function consoleGroupWarn(): void { 5 6 7 -` +`, ); }); }); @@ -901,7 +901,7 @@ unitTest(function consoleTable(): void { │ a │ "test" │ │ b │ 1 │ └───────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -914,7 +914,7 @@ unitTest(function consoleTable(): void { │ a │ │ │ b │ 30 │ └───────┴────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -930,7 +930,7 @@ unitTest(function consoleTable(): void { │ 3 │ 5 │ 6 │ │ │ 4 │ [ 7 ] │ [ 8 ] │ │ └───────┴───────┴───────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -945,7 +945,7 @@ unitTest(function consoleTable(): void { │ 2 │ 3 │ │ 3 │ "test" │ └────────────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -953,7 +953,7 @@ unitTest(function consoleTable(): void { new Map([ [1, "one"], [2, "two"], - ]) + ]), ); assertEquals( stripColor(out.toString()), @@ -963,7 +963,7 @@ unitTest(function consoleTable(): void { │ 0 │ 1 │ "one" │ │ 1 │ 2 │ "two" │ └────────────┴─────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -985,7 +985,7 @@ unitTest(function consoleTable(): void { │ g │ │ │ │ │ h │ │ │ │ └───────┴───────────┴───────────────────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1007,7 +1007,7 @@ unitTest(function consoleTable(): void { │ 3 │ │ │ 10 │ │ │ 4 │ "test" │ { b: 20, c: "test" } │ │ │ └───────┴────────┴──────────────────────┴────┴────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1018,7 +1018,7 @@ unitTest(function consoleTable(): void { │ (idx) │ ├───────┤ └───────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1029,7 +1029,7 @@ unitTest(function consoleTable(): void { │ (idx) │ ├───────┤ └───────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1040,7 +1040,7 @@ unitTest(function consoleTable(): void { │ (iter idx) │ ├────────────┤ └────────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1051,7 +1051,7 @@ unitTest(function consoleTable(): void { │ (iter idx) │ ├────────────┤ └────────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1069,7 +1069,7 @@ unitTest(function consoleTable(): void { │ 1 │ "你好" │ │ 2 │ "Amapá" │ └───────┴─────────┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1085,7 +1085,7 @@ unitTest(function consoleTable(): void { │ 0 │ 1 │ 2 │ │ 1 │ 3 │ 4 │ └───────┴───┴───┘ -` +`, ); }); mockConsole((console, out): void => { @@ -1099,7 +1099,7 @@ unitTest(function consoleTable(): void { │ 2 │ │ │ 3 │ 6 │ └───────┴───┘ -` +`, ); }); }); @@ -1169,11 +1169,11 @@ unitTest(function consoleTrace(): void { unitTest(function inspectSorted(): void { assertEquals( Deno.inspect({ b: 2, a: 1 }, { sorted: true }), - "{ a: 1, b: 2 }" + "{ a: 1, b: 2 }", ); assertEquals( Deno.inspect(new Set(["b", "a"]), { sorted: true }), - `Set { "a", "b" }` + `Set { "a", "b" }`, ); assertEquals( Deno.inspect( @@ -1181,9 +1181,9 @@ unitTest(function inspectSorted(): void { ["b", 2], ["a", 1], ]), - { sorted: true } + { sorted: true }, ), - `Map { "a" => 1, "b" => 2 }` + `Map { "a" => 1, "b" => 2 }`, ); }); @@ -1194,12 +1194,12 @@ unitTest(function inspectTrailingComma(): void { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", ], - { trailingComma: true } + { trailingComma: true }, ), `[ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", -]` +]`, ); assertEquals( Deno.inspect( @@ -1207,12 +1207,12 @@ unitTest(function inspectTrailingComma(): void { aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 1, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 2, }, - { trailingComma: true } + { trailingComma: true }, ), `{ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa: 1, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb: 2, -}` +}`, ); assertEquals( Deno.inspect( @@ -1220,12 +1220,12 @@ unitTest(function inspectTrailingComma(): void { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", ]), - { trailingComma: true } + { trailingComma: true }, ), `Set { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", -}` +}`, ); assertEquals( Deno.inspect( @@ -1233,12 +1233,12 @@ unitTest(function inspectTrailingComma(): void { ["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 1], ["bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", 2], ]), - { trailingComma: true } + { trailingComma: true }, ), `Map { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" => 1, "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb" => 2, -}` +}`, ); }); @@ -1248,18 +1248,18 @@ unitTest(function inspectCompact(): void { `{ a: 1, b: 2 -}` +}`, ); }); unitTest(function inspectIterableLimit(): void { assertEquals( Deno.inspect(["a", "b", "c"], { iterableLimit: 2 }), - `[ "a", "b", ... 1 more items ]` + `[ "a", "b", ... 1 more items ]`, ); assertEquals( Deno.inspect(new Set(["a", "b", "c"]), { iterableLimit: 2 }), - `Set { "a", "b", ... 1 more items }` + `Set { "a", "b", ... 1 more items }`, ); assertEquals( Deno.inspect( @@ -1268,8 +1268,8 @@ unitTest(function inspectIterableLimit(): void { ["b", 2], ["c", 3], ]), - { iterableLimit: 2 } + { iterableLimit: 2 }, ), - `Map { "a" => 1, "b" => 2, ... 1 more items }` + `Map { "a" => 1, "b" => 2, ... 1 more items }`, ); }); diff --git a/cli/tests/unit/copy_file_test.ts b/cli/tests/unit/copy_file_test.ts index 5abceb797..c45e4977b 100644 --- a/cli/tests/unit/copy_file_test.ts +++ b/cli/tests/unit/copy_file_test.ts @@ -20,7 +20,7 @@ function writeFileString(filename: string | URL, s: string): void { function assertSameContent( filename1: string | URL, - filename2: string | URL + filename2: string | URL, ): void { const data1 = Deno.readFileSync(filename1); const data2 = Deno.readFileSync(filename2); @@ -41,7 +41,7 @@ unitTest( assertSameContent(fromFilename, toFilename); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -49,10 +49,10 @@ unitTest( function copyFileSyncByUrl(): void { const tempDir = Deno.makeTempDirSync(); const fromUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/from.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/from.txt`, ); const toUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/to.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/to.txt`, ); writeFileString(fromUrl, "Hello world!"); Deno.copyFileSync(fromUrl, toUrl); @@ -62,7 +62,7 @@ unitTest( assertSameContent(fromUrl, toUrl); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -77,7 +77,7 @@ unitTest( }, Deno.errors.NotFound); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -86,7 +86,7 @@ unitTest( assertThrows(() => { Deno.copyFileSync("/from.txt", "/to.txt"); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -95,7 +95,7 @@ unitTest( assertThrows(() => { Deno.copyFileSync("/from.txt", "/to.txt"); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -114,7 +114,7 @@ unitTest( assertSameContent(fromFilename, toFilename); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -131,7 +131,7 @@ unitTest( assertSameContent(fromFilename, toFilename); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -139,10 +139,10 @@ unitTest( async function copyFileByUrl(): Promise<void> { const tempDir = Deno.makeTempDirSync(); const fromUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/from.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/from.txt`, ); const toUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/to.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/to.txt`, ); writeFileString(fromUrl, "Hello world!"); await Deno.copyFile(fromUrl, toUrl); @@ -152,7 +152,7 @@ unitTest( assertSameContent(fromUrl, toUrl); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -167,7 +167,7 @@ unitTest( }, Deno.errors.NotFound); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -186,7 +186,7 @@ unitTest( assertSameContent(fromFilename, toFilename); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -195,7 +195,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.copyFile("/from.txt", "/to.txt"); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -204,5 +204,5 @@ unitTest( await assertThrowsAsync(async () => { await Deno.copyFile("/from.txt", "/to.txt"); }, Deno.errors.PermissionDenied); - } + }, ); diff --git a/cli/tests/unit/dir_test.ts b/cli/tests/unit/dir_test.ts index 5b60b3dba..f9f4c9456 100644 --- a/cli/tests/unit/dir_test.ts +++ b/cli/tests/unit/dir_test.ts @@ -18,7 +18,7 @@ unitTest( assertEquals(current, path); } Deno.chdir(initialdir); - } + }, ); unitTest({ perms: { read: true, write: true } }, function dirCwdError(): void { @@ -44,7 +44,7 @@ unitTest({ perms: { read: false } }, function dirCwdPermError(): void { Deno.cwd(); }, Deno.errors.PermissionDenied, - "read access to <CWD>, run again with the --allow-read flag" + "read access to <CWD>, run again with the --allow-read flag", ); }); @@ -55,5 +55,5 @@ unitTest( assertThrows(() => { Deno.chdir(path); }, Deno.errors.NotFound); - } + }, ); diff --git a/cli/tests/unit/dispatch_json_test.ts b/cli/tests/unit/dispatch_json_test.ts index 938f4f6e3..4ba2fbea9 100644 --- a/cli/tests/unit/dispatch_json_test.ts +++ b/cli/tests/unit/dispatch_json_test.ts @@ -5,7 +5,7 @@ const openErrorStackPattern = new RegExp( at unwrapResponse \\(.*dispatch_json\\.ts:.*\\) at Object.sendAsync \\(.*dispatch_json\\.ts:.*\\) at async Object\\.open \\(.*files\\.ts:.*\\).*$`, - "ms" + "ms", ); unitTest( @@ -16,7 +16,7 @@ unitTest( .catch((error): void => { assertMatch(error.stack, openErrorStackPattern); }); - } + }, ); declare global { diff --git a/cli/tests/unit/dispatch_minimal_test.ts b/cli/tests/unit/dispatch_minimal_test.ts index f46c0e575..4af9e00db 100644 --- a/cli/tests/unit/dispatch_minimal_test.ts +++ b/cli/tests/unit/dispatch_minimal_test.ts @@ -11,7 +11,7 @@ const readErrorStackPattern = new RegExp( at unwrapResponse \\(.*dispatch_minimal\\.ts:.*\\) at Object.sendAsyncMinimal \\(.*dispatch_minimal\\.ts:.*\\) at async Object\\.read \\(.*io\\.ts:.*\\).*$`, - "ms" + "ms", ); unitTest(async function sendAsyncStackTrace(): Promise<void> { @@ -40,7 +40,7 @@ unitTest(function malformedMinimalControlBuffer(): void { const buf32 = new Int32Array( header.buffer, header.byteOffset, - header.byteLength / 4 + header.byteLength / 4, ); const arg = buf32[1]; const message = new TextDecoder().decode(res.slice(12)).trim(); diff --git a/cli/tests/unit/dom_iterable_test.ts b/cli/tests/unit/dom_iterable_test.ts index c4e535a25..f4690d5b9 100644 --- a/cli/tests/unit/dom_iterable_test.ts +++ b/cli/tests/unit/dom_iterable_test.ts @@ -8,7 +8,7 @@ function setup() { [dataSymbol] = new Map<string, number>(); constructor( - data: Array<[string, number]> | IterableIterator<[string, number]> + data: Array<[string, number]> | IterableIterator<[string, number]>, ) { for (const [key, value] of data) { this[dataSymbol].set(key, value); @@ -53,7 +53,7 @@ unitTest(function testDomIterable(): void { this: typeof scope, value: number, key: string, - parent: typeof domIterable + parent: typeof domIterable, ): void { assertEquals(parent, domIterable); assert(key != null); diff --git a/cli/tests/unit/error_stack_test.ts b/cli/tests/unit/error_stack_test.ts index 052cb9591..af7467684 100644 --- a/cli/tests/unit/error_stack_test.ts +++ b/cli/tests/unit/error_stack_test.ts @@ -26,7 +26,7 @@ interface CallSite { function getMockCallSite( fileName: string, lineNumber: number | null, - columnNumber: number | null + columnNumber: number | null, ): CallSite { return { getThis(): unknown { @@ -87,7 +87,7 @@ unitTest(function prepareStackTrace(): void { assert(typeof MockError.prepareStackTrace === "function"); const prepareStackTrace: ( error: Error, - structuredStackTrace: CallSite[] + structuredStackTrace: CallSite[], ) => string = MockError.prepareStackTrace; const result = prepareStackTrace(new Error("foo"), [ getMockCallSite("CLI_SNAPSHOT.js", 23, 0), diff --git a/cli/tests/unit/event_target_test.ts b/cli/tests/unit/event_target_test.ts index cfbe5285b..34f9019d3 100644 --- a/cli/tests/unit/event_target_test.ts +++ b/cli/tests/unit/event_target_test.ts @@ -37,7 +37,7 @@ unitTest(function anEventTargetCanBeSubclassed(): void { on( type: string, callback: ((e: Event) => void) | null, - options?: AddEventListenerOptions + options?: AddEventListenerOptions, ): void { this.addEventListener(type, callback, options); } @@ -45,7 +45,7 @@ unitTest(function anEventTargetCanBeSubclassed(): void { off( type: string, callback: ((e: Event) => void) | null, - options?: EventListenerOptions + options?: EventListenerOptions, ): void { this.removeEventListener(type, callback, options); } @@ -221,5 +221,5 @@ unitTest( target.removeEventListener("foo", listener); target.dispatchEvent(event); assertEquals(callCount, 2); - } + }, ); diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index c93cc0c85..9562c48c7 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -16,7 +16,7 @@ unitTest({ perms: { net: true } }, async function fetchProtocolError(): Promise< await fetch("file:///"); }, TypeError, - "not supported" + "not supported", ); }); @@ -28,9 +28,9 @@ unitTest( await fetch("http://localhost:4000"); }, Deno.errors.Http, - "error trying to connect" + "error trying to connect", ); - } + }, ); unitTest({ perms: { net: true } }, async function fetchJsonSuccess(): Promise< @@ -55,7 +55,7 @@ unitTest({ perms: { net: true } }, async function fetchUrl(): Promise<void> { unitTest({ perms: { net: true } }, async function fetchURL(): Promise<void> { const response = await fetch( - new URL("http://localhost:4545/cli/tests/fixture.json") + new URL("http://localhost:4545/cli/tests/fixture.json"), ); assertEquals(response.url, "http://localhost:4545/cli/tests/fixture.json"); const _json = await response.json(); @@ -95,7 +95,7 @@ unitTest( { perms: { net: true } }, async function fetchBodyUsedReader(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/fixture.json" + "http://localhost:4545/cli/tests/fixture.json", ); assert(response.body !== null); @@ -106,14 +106,14 @@ unitTest( reader.releaseLock(); await response.json(); assertEquals(response.bodyUsed, true); - } + }, ); unitTest( { perms: { net: true } }, async function fetchBodyUsedCancelStream(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/fixture.json" + "http://localhost:4545/cli/tests/fixture.json", ); assert(response.body !== null); @@ -121,7 +121,7 @@ unitTest( const promise = response.body.cancel(); assertEquals(response.bodyUsed, true); await promise; - } + }, ); unitTest({ perms: { net: true } }, async function fetchAsyncIterator(): Promise< @@ -176,7 +176,7 @@ unitTest( } assertEquals(total, data.length); - } + }, ); unitTest({ perms: { net: true } }, async function responseClone(): Promise< @@ -206,7 +206,7 @@ unitTest( { perms: { net: true } }, async function fetchMultipartFormDataSuccess(): Promise<void> { const response = await fetch( - "http://localhost:4545/multipart_form_data.txt" + "http://localhost:4545/multipart_form_data.txt", ); const formData = await response.formData(); assert(formData.has("field_1")); @@ -216,28 +216,28 @@ unitTest( assertEquals(file.name, "file.js"); assertEquals(await file.text(), `console.log("Hi")`); - } + }, ); unitTest( { perms: { net: true } }, async function fetchURLEncodedFormDataSuccess(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt" + "http://localhost:4545/cli/tests/subdir/form_urlencoded.txt", ); const formData = await response.formData(); assert(formData.has("field_1")); assertEquals(formData.get("field_1")!.toString(), "Hi"); assert(formData.has("field_2")); assertEquals(formData.get("field_2")!.toString(), "<Deno>"); - } + }, ); unitTest( { perms: { net: true } }, async function fetchInitFormDataBinaryFileBody(): Promise<void> { // Some random bytes - // prettier-ignore + // deno-fmt-ignore const binaryFile = new Uint8Array([108,2,0,0,145,22,162,61,157,227,166,77,138,75,180,56,119,188,177,183]); const response = await fetch("http://localhost:4545/echo_multipart_file", { method: "POST", @@ -249,7 +249,7 @@ unitTest( assertEquals(resultFile.type, "application/octet-stream"); assertEquals(resultFile.name, "file.bin"); assertEquals(new Uint8Array(await resultFile.arrayBuffer()), binaryFile); - } + }, ); unitTest( @@ -257,14 +257,14 @@ unitTest( async function fetchInitFormDataMultipleFilesBody(): Promise<void> { const files = [ { - // prettier-ignore + // deno-fmt-ignore content: new Uint8Array([137,80,78,71,13,10,26,10, 137, 1, 25]), type: "image/png", name: "image", fileName: "some-image.png", }, { - // prettier-ignore + // deno-fmt-ignore content: new Uint8Array([108,2,0,0,145,22,162,61,157,227,166,77,138,75,180,56,119,188,177,183]), name: "file", fileName: "file.bin", @@ -283,7 +283,7 @@ unitTest( form.append( file.name, new Blob([file.content], { type: file.type }), - file.fileName + file.fileName, ); } const response = await fetch("http://localhost:4545/echo_server", { @@ -300,10 +300,10 @@ unitTest( assertEquals(file.expectedType || file.type, resultFile.type); assertEquals( new Uint8Array(await resultFile.arrayBuffer()), - file.content + file.content, ); } - } + }, ); unitTest( @@ -317,7 +317,7 @@ unitTest( assertEquals(response.url, "http://localhost:4545/README.md"); const body = await response.text(); assert(body.includes("Deno")); - } + }, ); unitTest( @@ -326,13 +326,13 @@ unitTest( }, async function fetchWithRelativeRedirection(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/001_hello.js" + "http://localhost:4545/cli/tests/001_hello.js", ); assertEquals(response.status, 200); assertEquals(response.statusText, "OK"); const body = await response.text(); assert(body.includes("Hello")); - } + }, ); unitTest( @@ -353,7 +353,7 @@ unitTest( assertEquals(response.status, 404); assertEquals(await response.text(), ""); } - } + }, ); unitTest( @@ -365,7 +365,7 @@ unitTest( assertEquals(response.status, 0); // network error assertEquals(response.type, "error"); assertEquals(response.ok, false); - } + }, ); unitTest( @@ -379,7 +379,7 @@ unitTest( const text = await response.text(); assertEquals(text, data); assert(response.headers.get("content-type")!.startsWith("text/plain")); - } + }, ); unitTest( @@ -393,7 +393,7 @@ unitTest( const response = await fetch(req); const text = await response.text(); assertEquals(text, data); - } + }, ); unitTest( @@ -406,7 +406,7 @@ unitTest( }); const text = await response.text(); assertEquals(text, data); - } + }, ); unitTest( @@ -419,7 +419,7 @@ unitTest( }); const text = await response.text(); assertEquals(text, data); - } + }, ); unitTest( @@ -436,9 +436,9 @@ unitTest( assert( response.headers .get("content-type")! - .startsWith("application/x-www-form-urlencoded") + .startsWith("application/x-www-form-urlencoded"), ); - } + }, ); unitTest({ perms: { net: true } }, async function fetchInitBlobBody(): Promise< @@ -468,7 +468,7 @@ unitTest( }); const resultForm = await response.formData(); assertEquals(form.get("field"), resultForm.get("field")); - } + }, ); unitTest( @@ -486,7 +486,7 @@ unitTest( const file = resultForm.get("file"); assert(file instanceof File); assertEquals(file.name, "blob"); - } + }, ); unitTest( @@ -500,7 +500,7 @@ unitTest( new Blob([new TextEncoder().encode(fileContent)], { type: "text/plain", }), - "deno.txt" + "deno.txt", ); const response = await fetch("http://localhost:4545/echo_server", { method: "POST", @@ -516,7 +516,7 @@ unitTest( assertEquals(file.name, resultFile.name); assertEquals(file.type, resultFile.type); assertEquals(await file.text(), await resultFile.text()); - } + }, ); unitTest({ perms: { net: true } }, async function fetchUserAgent(): Promise< @@ -561,8 +561,8 @@ function bufferServer(addr: string): Deno.Buffer { const p1 = buf.readFrom(conn); const p2 = conn.write( new TextEncoder().encode( - "HTTP/1.0 404 Not Found\r\nContent-Length: 2\r\n\r\nNF" - ) + "HTTP/1.0 404 Not Found\r\nContent-Length: 2\r\n\r\nNF", + ), ); // Wait for both an EOF on the read side of the socket and for the write to // complete before closing it. Due to keep-alive, the EOF won't be sent @@ -606,7 +606,7 @@ unitTest( `host: ${addr}\r\n\r\n`, ].join(""); assertEquals(actual, expected); - } + }, ); unitTest( @@ -643,7 +643,7 @@ unitTest( body, ].join(""); assertEquals(actual, expected); - } + }, ); unitTest( @@ -680,7 +680,7 @@ unitTest( bodyStr, ].join(""); assertEquals(actual, expected); - } + }, ); unitTest( @@ -698,12 +698,12 @@ unitTest( try { await response.text(); fail( - "Reponse.text() didn't throw on a filtered response without a body (type opaqueredirect)" + "Reponse.text() didn't throw on a filtered response without a body (type opaqueredirect)", ); } catch (e) { return; } - } + }, ); unitTest( @@ -721,12 +721,12 @@ unitTest( try { await response.text(); fail( - "Reponse.text() didn't throw on a filtered response without a body (type error)" + "Reponse.text() didn't throw on a filtered response without a body (type error)", ); } catch (e) { return; } - } + }, ); unitTest(function responseRedirect(): void { @@ -753,7 +753,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyReadTwice(): Promise< try { await response[method](); fail( - "Reading body multiple times should failed, the stream should've been locked." + "Reading body multiple times should failed, the stream should've been locked.", ); } catch { // pass @@ -765,7 +765,7 @@ unitTest( { perms: { net: true } }, async function fetchBodyReaderAfterRead(): Promise<void> { const response = await fetch( - "http://localhost:4545/cli/tests/fixture.json" + "http://localhost:4545/cli/tests/fixture.json", ); assert(response.body !== null); const reader = await response.body.getReader(); @@ -781,7 +781,7 @@ unitTest( } catch { // pass } - } + }, ); unitTest( @@ -809,7 +809,7 @@ unitTest( } assertEquals(total, data.length); - } + }, ); unitTest( @@ -839,7 +839,7 @@ unitTest( total += value.length; } assertEquals(total, data.length); - } + }, ); unitTest( @@ -851,7 +851,7 @@ unitTest( // After ReadableStream.cancel is called, resource handle must be closed // The test should not fail with: Test case is leaking resources await res.body.cancel(); - } + }, ); unitTest( @@ -869,7 +869,7 @@ unitTest( assertEquals(res.body, null); assertEquals(res.status, status); } - } + }, ); unitTest( @@ -888,7 +888,7 @@ unitTest( // Make sure Body content-type is correctly set assertEquals(blob.type, "application/octet-stream"); assertEquals(blob.size, body.byteLength); - } + }, ); unitTest(function fetchResponseConstructorNullBody(): void { @@ -902,7 +902,7 @@ unitTest(function fetchResponseConstructorNullBody(): void { assert(e instanceof TypeError); assertEquals( e.message, - "Response with null body status cannot have body" + "Response with null body status cannot have body", ); } } @@ -921,7 +921,7 @@ unitTest(function fetchResponseConstructorInvalidStatus(): void { assert(e instanceof RangeError); assertEquals( e.message, - `The status provided (${status}) is outside the range [200, 599]` + `The status provided (${status}) is outside the range [200, 599]`, ); } } diff --git a/cli/tests/unit/file_test.ts b/cli/tests/unit/file_test.ts index 4941554ad..f97283b7f 100644 --- a/cli/tests/unit/file_test.ts +++ b/cli/tests/unit/file_test.ts @@ -60,7 +60,7 @@ unitTest(function fileVariousFileBits(): void { new Uint16Array([0x5353]), new Uint32Array([0x53534150]), ], - 16 + 16, ); }); diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index aca63928b..8992fa71c 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -54,7 +54,7 @@ unitTest( assertEquals(totalSize, 12); assertEquals(iterations, 2); file.close(); - } + }, ); unitTest({ perms: { read: true } }, function filesIterSync(): void { @@ -86,7 +86,7 @@ unitTest( assertEquals(totalSize, 12); assertEquals(iterations, 2); file.close(); - } + }, ); unitTest(async function readerIter(): Promise<void> { @@ -175,7 +175,7 @@ unitTest( if (Deno.build.os !== "windows") { assertEquals(pathInfo.mode! & 0o777, 0o626 & ~Deno.umask()); } - } + }, ); unitTest( @@ -194,7 +194,7 @@ unitTest( if (Deno.build.os !== "windows") { assertEquals(pathInfo.mode! & 0o777, 0o626 & ~Deno.umask()); } - } + }, ); unitTest( @@ -204,7 +204,9 @@ unitTest( function openSyncUrl(): void { const tempDir = Deno.makeTempDirSync(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test_open.txt` + `file://${ + Deno.build.os === "windows" ? "/" : "" + }${tempDir}/test_open.txt`, ); const file = Deno.openSync(fileUrl, { write: true, @@ -218,7 +220,7 @@ unitTest( } Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -228,7 +230,9 @@ unitTest( async function openUrl(): Promise<void> { const tempDir = await Deno.makeTempDir(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test_open.txt` + `file://${ + Deno.build.os === "windows" ? "/" : "" + }${tempDir}/test_open.txt`, ); const file = await Deno.open(fileUrl, { write: true, @@ -242,7 +246,7 @@ unitTest( } Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -255,7 +259,7 @@ unitTest( await Deno.open(filename, options); }, Deno.errors.PermissionDenied); } - } + }, ); unitTest(async function openOptions(): Promise<void> { @@ -265,7 +269,7 @@ unitTest(async function openOptions(): Promise<void> { await Deno.open(filename, { write: false }); }, Error, - "OpenOptions requires at least one option to be true" + "OpenOptions requires at least one option to be true", ); await assertThrowsAsync( @@ -273,7 +277,7 @@ unitTest(async function openOptions(): Promise<void> { await Deno.open(filename, { truncate: true, write: false }); }, Error, - "'truncate' option requires 'write' option" + "'truncate' option requires 'write' option", ); await assertThrowsAsync( @@ -281,7 +285,7 @@ unitTest(async function openOptions(): Promise<void> { await Deno.open(filename, { create: true, write: false }); }, Error, - "'create' or 'createNew' options require 'write' or 'append' option" + "'create' or 'createNew' options require 'write' or 'append' option", ); await assertThrowsAsync( @@ -289,7 +293,7 @@ unitTest(async function openOptions(): Promise<void> { await Deno.open(filename, { createNew: true, append: false }); }, Error, - "'create' or 'createNew' options require 'write' or 'append' option" + "'create' or 'createNew' options require 'write' or 'append' option", ); }); @@ -318,11 +322,11 @@ unitTest( async (): Promise<void> => { // eslint-disable-next-line @typescript-eslint/no-explicit-any await file.write(null as any); - } + }, ); // TODO: Check error kind when dispatch_minimal pipes errors properly file.close(); await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -350,7 +354,7 @@ unitTest( file.close(); await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -360,7 +364,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.open(filename, { read: true }); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -381,7 +385,7 @@ unitTest( // TODO: test different modes await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -389,7 +393,7 @@ unitTest( async function createFileWithUrl(): Promise<void> { const tempDir = await Deno.makeTempDir(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt`, ); const f = await Deno.create(fileUrl); let fileInfo = Deno.statSync(fileUrl); @@ -403,7 +407,7 @@ unitTest( f.close(); await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -424,7 +428,7 @@ unitTest( // TODO: test different modes await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -432,7 +436,7 @@ unitTest( async function createSyncFileWithUrl(): Promise<void> { const tempDir = await Deno.makeTempDir(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt`, ); const f = Deno.createSync(fileUrl); let fileInfo = Deno.statSync(fileUrl); @@ -446,7 +450,7 @@ unitTest( f.close(); await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -489,7 +493,7 @@ unitTest( const fileSize = Deno.statSync(filename).size; assertEquals(fileSize, 0); await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -525,7 +529,7 @@ unitTest( file.close(); await Deno.remove(tempDir, { recursive: true }); - } + }, ); unitTest({ perms: { read: true } }, async function seekStart(): Promise<void> { @@ -634,7 +638,7 @@ unitTest({ perms: { read: true } }, async function seekMode(): Promise<void> { await file.seek(1, -1); }, TypeError, - "Invalid seek mode" + "Invalid seek mode", ); // We should still be able to read the file diff --git a/cli/tests/unit/form_data_test.ts b/cli/tests/unit/form_data_test.ts index 338fdd089..30e9a8311 100644 --- a/cli/tests/unit/form_data_test.ts +++ b/cli/tests/unit/form_data_test.ts @@ -157,7 +157,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { assertEquals(hasThrown, 2); assertStringContains( errMsg, - `${method} requires at least 1 argument, but only 0 present` + `${method} requires at least 1 argument, but only 0 present`, ); }); @@ -181,7 +181,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { assertEquals(hasThrown, 2); assertStringContains( errMsg, - `${method} requires at least 2 arguments, but only 0 present` + `${method} requires at least 2 arguments, but only 0 present`, ); hasThrown = 0; @@ -201,7 +201,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { assertEquals(hasThrown, 2); assertStringContains( errMsg, - `${method} requires at least 2 arguments, but only 1 present` + `${method} requires at least 2 arguments, but only 1 present`, ); }); }); diff --git a/cli/tests/unit/fs_events_test.ts b/cli/tests/unit/fs_events_test.ts index ec146f185..f2dd59d79 100644 --- a/cli/tests/unit/fs_events_test.ts +++ b/cli/tests/unit/fs_events_test.ts @@ -16,7 +16,7 @@ unitTest({ perms: { read: true } }, function watchFsInvalidPath() { Deno.watchFs("non-existant.file"); }, Error, - "Input watch path is neither a file nor a directory" + "Input watch path is neither a file nor a directory", ); } else { assertThrows(() => { @@ -26,7 +26,7 @@ unitTest({ perms: { read: true } }, function watchFsInvalidPath() { }); async function getTwoEvents( - iter: AsyncIterableIterator<Deno.FsEvent> + iter: AsyncIterableIterator<Deno.FsEvent>, ): Promise<Deno.FsEvent[]> { const events = []; for await (const event of iter) { @@ -58,5 +58,5 @@ unitTest( assert(events[0].paths[0].includes(testDir)); assert(events[1].kind == "create" || events[1].kind == "modify"); assert(events[1].paths[0].includes(testDir)); - } + }, ); diff --git a/cli/tests/unit/headers_test.ts b/cli/tests/unit/headers_test.ts index 2156fb56b..5dc23355c 100644 --- a/cli/tests/unit/headers_test.ts +++ b/cli/tests/unit/headers_test.ts @@ -27,7 +27,7 @@ unitTest(function newHeaderTest(): void { } catch (e) { assertEquals( e.message, - "Failed to construct 'Headers'; The provided value was not valid" + "Failed to construct 'Headers'; The provided value was not valid", ); } }); @@ -91,7 +91,7 @@ unitTest(function headerHasSuccess(): void { assert(headers.has(name), "headers has name " + name); assert( !headers.has("nameNotInHeaders"), - "headers do not have header: nameNotInHeaders" + "headers do not have header: nameNotInHeaders", ); } }); @@ -287,7 +287,7 @@ unitTest(function headerParamsArgumentsCheck(): void { assertEquals(hasThrown, 2); assertStringContains( errMsg, - `${method} requires at least 1 argument, but only 0 present` + `${method} requires at least 1 argument, but only 0 present`, ); }); @@ -311,7 +311,7 @@ unitTest(function headerParamsArgumentsCheck(): void { assertEquals(hasThrown, 2); assertStringContains( errMsg, - `${method} requires at least 2 arguments, but only 0 present` + `${method} requires at least 2 arguments, but only 0 present`, ); hasThrown = 0; @@ -331,7 +331,7 @@ unitTest(function headerParamsArgumentsCheck(): void { assertEquals(hasThrown, 2); assertStringContains( errMsg, - `${method} requires at least 2 arguments, but only 1 present` + `${method} requires at least 2 arguments, but only 1 present`, ); }); }); @@ -411,7 +411,7 @@ unitTest(function customInspectReturnsCorrectHeadersFormat(): void { const singleHeader = new Headers([["Content-Type", "application/json"]]); assertEquals( stringify(singleHeader), - "Headers { content-type: application/json }" + "Headers { content-type: application/json }", ); const multiParamHeader = new Headers([ ["Content-Type", "application/json"], @@ -419,6 +419,6 @@ unitTest(function customInspectReturnsCorrectHeadersFormat(): void { ]); assertEquals( stringify(multiParamHeader), - "Headers { content-type: application/json, content-length: 1337 }" + "Headers { content-type: application/json, content-length: 1337 }", ); }); diff --git a/cli/tests/unit/link_test.ts b/cli/tests/unit/link_test.ts index c84d0f6a3..db910ee7c 100644 --- a/cli/tests/unit/link_test.ts +++ b/cli/tests/unit/link_test.ts @@ -19,14 +19,14 @@ unitTest( Deno.writeFileSync(newName, new TextEncoder().encode(newData2)); assertEquals( newData2, - new TextDecoder().decode(Deno.readFileSync(oldName)) + new TextDecoder().decode(Deno.readFileSync(oldName)), ); // Writing to oldname also affects newname. const newData3 = "ModifiedAgain"; Deno.writeFileSync(oldName, new TextEncoder().encode(newData3)); assertEquals( newData3, - new TextDecoder().decode(Deno.readFileSync(newName)) + new TextDecoder().decode(Deno.readFileSync(newName)), ); // Remove oldname. File still accessible through newname. Deno.removeSync(oldName); @@ -35,9 +35,9 @@ unitTest( assert(!newNameStat.isSymlink); // Not a symlink. assertEquals( newData3, - new TextDecoder().decode(Deno.readFileSync(newName)) + new TextDecoder().decode(Deno.readFileSync(newName)), ); - } + }, ); unitTest( @@ -53,7 +53,7 @@ unitTest( assertThrows(() => { Deno.linkSync(oldName, newName); }, Deno.errors.AlreadyExists); - } + }, ); unitTest( @@ -66,7 +66,7 @@ unitTest( assertThrows(() => { Deno.linkSync(oldName, newName); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -75,7 +75,7 @@ unitTest( assertThrows(() => { Deno.linkSync("oldbaddir", "newbaddir"); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -84,7 +84,7 @@ unitTest( assertThrows(() => { Deno.linkSync("oldbaddir", "newbaddir"); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -105,14 +105,14 @@ unitTest( Deno.writeFileSync(newName, new TextEncoder().encode(newData2)); assertEquals( newData2, - new TextDecoder().decode(Deno.readFileSync(oldName)) + new TextDecoder().decode(Deno.readFileSync(oldName)), ); // Writing to oldname also affects newname. const newData3 = "ModifiedAgain"; Deno.writeFileSync(oldName, new TextEncoder().encode(newData3)); assertEquals( newData3, - new TextDecoder().decode(Deno.readFileSync(newName)) + new TextDecoder().decode(Deno.readFileSync(newName)), ); // Remove oldname. File still accessible through newname. Deno.removeSync(oldName); @@ -121,7 +121,7 @@ unitTest( assert(!newNameStat.isSymlink); // Not a symlink. assertEquals( newData3, - new TextDecoder().decode(Deno.readFileSync(newName)) + new TextDecoder().decode(Deno.readFileSync(newName)), ); - } + }, ); diff --git a/cli/tests/unit/make_temp_test.ts b/cli/tests/unit/make_temp_test.ts index c1498aa64..05a422cfd 100644 --- a/cli/tests/unit/make_temp_test.ts +++ b/cli/tests/unit/make_temp_test.ts @@ -36,7 +36,7 @@ unitTest( if (Deno.build.os !== "windows") { assertEquals(pathInfo.mode! & 0o777, 0o700 & ~Deno.umask()); } - } + }, ); unitTest(function makeTempDirSyncPerm(): void { @@ -67,7 +67,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.makeTempDir({ dir: "/baddir" }); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -78,7 +78,7 @@ unitTest( if (Deno.build.os !== "windows") { assertEquals(pathInfo.mode! & 0o777, 0o700 & ~Deno.umask()); } - } + }, ); unitTest({ perms: { write: true } }, function makeTempFileSyncSuccess(): void { @@ -111,7 +111,7 @@ unitTest( if (Deno.build.os !== "windows") { assertEquals(pathInfo.mode! & 0o777, 0o600 & ~Deno.umask()); } - } + }, ); unitTest(function makeTempFileSyncPerm(): void { @@ -143,7 +143,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.makeTempFile({ dir: "/baddir" }); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -154,5 +154,5 @@ unitTest( if (Deno.build.os !== "windows") { assertEquals(pathInfo.mode! & 0o777, 0o600 & ~Deno.umask()); } - } + }, ); diff --git a/cli/tests/unit/metrics_test.ts b/cli/tests/unit/metrics_test.ts index 9b7d83887..48ddf30d7 100644 --- a/cli/tests/unit/metrics_test.ts +++ b/cli/tests/unit/metrics_test.ts @@ -39,7 +39,7 @@ unitTest( const metrics = Deno.metrics(); assert(metrics.opsDispatched === metrics.opsCompleted); assert(metrics.opsDispatchedSync === metrics.opsCompletedSync); - } + }, ); unitTest( @@ -54,5 +54,5 @@ unitTest( assert(metrics.opsDispatched === metrics.opsCompleted); assert(metrics.opsDispatchedSync === metrics.opsCompletedSync); assert(metrics.opsDispatchedAsync === metrics.opsCompletedAsync); - } + }, ); diff --git a/cli/tests/unit/mkdir_test.ts b/cli/tests/unit/mkdir_test.ts index 32632bfef..449c79747 100644 --- a/cli/tests/unit/mkdir_test.ts +++ b/cli/tests/unit/mkdir_test.ts @@ -21,7 +21,7 @@ unitTest( const path = Deno.makeTempDirSync() + "/dir"; Deno.mkdirSync(path); assertDirectory(path); - } + }, ); unitTest( @@ -30,7 +30,7 @@ unitTest( const path = Deno.makeTempDirSync() + "/dir"; Deno.mkdirSync(path, { mode: 0o737 }); assertDirectory(path, 0o737); - } + }, ); unitTest({ perms: { write: false } }, function mkdirSyncPerm(): void { @@ -45,7 +45,7 @@ unitTest( const path = Deno.makeTempDirSync() + "/dir"; await Deno.mkdir(path); assertDirectory(path); - } + }, ); unitTest( @@ -54,7 +54,7 @@ unitTest( const path = Deno.makeTempDirSync() + "/dir"; await Deno.mkdir(path, { mode: 0o737 }); assertDirectory(path, 0o737); - } + }, ); unitTest({ perms: { write: true } }, function mkdirErrSyncIfExists(): void { @@ -77,7 +77,7 @@ unitTest( const path = Deno.makeTempDirSync() + "/nested/directory"; Deno.mkdirSync(path, { recursive: true }); assertDirectory(path); - } + }, ); unitTest( @@ -86,7 +86,7 @@ unitTest( const path = Deno.makeTempDirSync() + "/nested/directory"; await Deno.mkdir(path, { recursive: true }); assertDirectory(path); - } + }, ); unitTest( @@ -97,7 +97,7 @@ unitTest( Deno.mkdirSync(path, { mode: 0o737, recursive: true }); assertDirectory(path, 0o737); assertDirectory(nested, 0o737); - } + }, ); unitTest( @@ -108,7 +108,7 @@ unitTest( await Deno.mkdir(path, { mode: 0o737, recursive: true }); assertDirectory(path, 0o737); assertDirectory(nested, 0o737); - } + }, ); unitTest( @@ -126,7 +126,7 @@ unitTest( Deno.mkdirSync(pathLink, { recursive: true, mode: 0o731 }); assertDirectory(path, 0o737); } - } + }, ); unitTest( @@ -144,7 +144,7 @@ unitTest( await Deno.mkdir(pathLink, { recursive: true, mode: 0o731 }); assertDirectory(path, 0o737); } - } + }, ); unitTest( @@ -195,5 +195,5 @@ unitTest( Deno.mkdirSync(danglingLink, { recursive: true }); }, Deno.errors.AlreadyExists); } - } + }, ); diff --git a/cli/tests/unit/net_test.ts b/cli/tests/unit/net_test.ts index e970f0360..793082ced 100644 --- a/cli/tests/unit/net_test.ts +++ b/cli/tests/unit/net_test.ts @@ -34,7 +34,7 @@ unitTest( assertEquals(socket.addr.hostname, "127.0.0.1"); assertEquals(socket.addr.port, 3500); socket.close(); - } + }, ); unitTest( @@ -48,7 +48,7 @@ unitTest( assert(socket.addr.transport === "unix"); assertEquals(socket.addr.path, filePath); socket.close(); - } + }, ); unitTest( @@ -62,7 +62,7 @@ unitTest( assert(socket.addr.transport === "unixpacket"); assertEquals(socket.addr.path, filePath); socket.close(); - } + }, ); unitTest( @@ -78,9 +78,9 @@ unitTest( await p; }, Deno.errors.BadResource, - "Listener has been closed" + "Listener has been closed", ); - } + }, ); unitTest( @@ -98,9 +98,9 @@ unitTest( await p; }, Deno.errors.BadResource, - "Listener has been closed" + "Listener has been closed", ); - } + }, ); unitTest( @@ -123,7 +123,7 @@ unitTest( listener.close(); await Promise.all([p, p1]); assertEquals(acceptErrCount, 1); - } + }, ); // TODO(jsouto): Enable when tokio updates mio to v0.7! @@ -148,7 +148,7 @@ unitTest( listener.close(); await [p, p1]; assertEquals(acceptErrCount, 1); - } + }, ); unitTest({ perms: { net: true } }, async function netTcpDialListen(): Promise< @@ -163,7 +163,7 @@ unitTest({ perms: { net: true } }, async function netTcpDialListen(): Promise< assertEquals(conn.localAddr.port, 3500); await conn.write(new Uint8Array([1, 2, 3])); conn.close(); - } + }, ); const conn = await Deno.connect({ hostname: "127.0.0.1", port: 3500 }); @@ -200,7 +200,7 @@ unitTest( assertEquals(conn.localAddr.path, filePath); await conn.write(new Uint8Array([1, 2, 3])); conn.close(); - } + }, ); const conn = await Deno.connect({ path: filePath, transport: "unix" }); assert(conn.remoteAddr.transport === "unix"); @@ -221,7 +221,7 @@ unitTest( listener.close(); conn.close(); - } + }, ); unitTest( @@ -251,7 +251,7 @@ unitTest( assertEquals(3, recvd[2]); alice.close(); bob.close(); - } + }, ); unitTest( @@ -266,7 +266,7 @@ unitTest( const b = socket.send(new Uint8Array(), socket.addr); await Promise.all([a, b]); socket.close(); - } + }, ); unitTest( @@ -300,7 +300,7 @@ unitTest( assertEquals(3, recvd[2]); alice.close(); bob.close(); - } + }, ); unitTest( @@ -336,7 +336,7 @@ unitTest( conn2.close(); await promise; - } + }, ); unitTest( @@ -349,7 +349,7 @@ unitTest( const nextAfterClosing = listener[Symbol.asyncIterator]().next(); assertEquals(await nextAfterClosing, { value: undefined, done: true }); - } + }, ); unitTest( @@ -362,7 +362,7 @@ unitTest( const nextAfterClosing = socket[Symbol.asyncIterator]().next(); assertEquals(await nextAfterClosing, { value: undefined, done: true }); - } + }, ); unitTest( @@ -376,7 +376,7 @@ unitTest( const nextAfterClosing = socket[Symbol.asyncIterator]().next(); assertEquals(await nextAfterClosing, { value: undefined, done: true }); - } + }, ); unitTest( @@ -393,7 +393,7 @@ unitTest( const nextAfterClosing = socket[Symbol.asyncIterator]().next(); assertEquals(await nextAfterClosing, { value: undefined, done: true }); - } + }, ); unitTest( @@ -428,7 +428,7 @@ unitTest( listener.close(); conn.close(); - } + }, ); unitTest( @@ -462,7 +462,7 @@ unitTest( closeDeferred.resolve(); listener.close(); conn.close(); - } + }, ); unitTest( @@ -488,7 +488,7 @@ unitTest( closeDeferred.resolve(); listener.close(); conn.close(); - } + }, ); unitTest( @@ -531,5 +531,5 @@ unitTest( acceptedConn!.close(); listener.close(); await resolvable; - } + }, ); diff --git a/cli/tests/unit/os_test.ts b/cli/tests/unit/os_test.ts index e969464e5..79f70afac 100644 --- a/cli/tests/unit/os_test.ts +++ b/cli/tests/unit/os_test.ts @@ -54,7 +54,7 @@ unitTest( // It is then verified that these match with the values of `expectedEnv`. const checkChildEnv = async ( inputEnv: Record<string, string>, - expectedEnv: Record<string, string> + expectedEnv: Record<string, string>, ): Promise<void> => { const src = ` console.log( @@ -69,7 +69,7 @@ unitTest( assertEquals(status.success, true); const expectedValues = Object.values(expectedEnv); const actualValues = JSON.parse( - new TextDecoder().decode(await proc.output()) + new TextDecoder().decode(await proc.output()), ); assertEquals(actualValues, expectedValues); proc.close(); @@ -87,7 +87,7 @@ unitTest( assertNotEquals(lc1, uc1); await checkChildEnv( { [lc1]: "mu", [uc1]: "MU" }, - { [lc1]: "mu", [uc1]: "MU" } + { [lc1]: "mu", [uc1]: "MU" }, ); // Check that 'dž' and 'DŽ' are folded, but 'Dž' is preserved. @@ -98,13 +98,13 @@ unitTest( assertNotEquals(c2, uc2); await checkChildEnv( { [c2]: "Dz", [lc2]: "dz" }, - { [c2]: "Dz", [lc2]: "dz", [uc2]: "dz" } + { [c2]: "Dz", [lc2]: "dz", [uc2]: "dz" }, ); await checkChildEnv( { [c2]: "Dz", [uc2]: "DZ" }, - { [c2]: "Dz", [uc2]: "DZ", [lc2]: "DZ" } + { [c2]: "Dz", [uc2]: "DZ", [lc2]: "DZ" }, ); - } + }, ); unitTest(function osPid(): void { @@ -130,7 +130,7 @@ unitTest( const expected = Deno.pid; const actual = parseInt(decoder.decode(output)); assertEquals(actual, expected); - } + }, ); unitTest({ perms: { read: true } }, function execPath(): void { @@ -143,7 +143,7 @@ unitTest({ perms: { read: false } }, function execPathPerm(): void { Deno.execPath(); }, Deno.errors.PermissionDenied, - "read access to <exec_path>, run again with the --allow-read flag" + "read access to <exec_path>, run again with the --allow-read flag", ); }); diff --git a/cli/tests/unit/path_from_url_test.ts b/cli/tests/unit/path_from_url_test.ts index d43245c06..047451d48 100644 --- a/cli/tests/unit/path_from_url_test.ts +++ b/cli/tests/unit/path_from_url_test.ts @@ -8,11 +8,11 @@ unitTest( function pathFromURLPosix(): void { assertEquals( pathFromURL(new URL("file:///test/directory")), - "/test/directory" + "/test/directory", ); assertEquals(pathFromURL(new URL("file:///space_ .txt")), "/space_ .txt"); assertThrows(() => pathFromURL(new URL("https://deno.land/welcome.ts"))); - } + }, ); unitTest( @@ -20,11 +20,11 @@ unitTest( function pathFromURLWin32(): void { assertEquals( pathFromURL(new URL("file:///c:/windows/test")), - "c:\\windows\\test" + "c:\\windows\\test", ); assertEquals( pathFromURL(new URL("file:///c:/space_ .txt")), - "c:\\space_ .txt" + "c:\\space_ .txt", ); assertThrows(() => pathFromURL(new URL("https://deno.land/welcome.ts"))); /* TODO(ry) Add tests for these situations @@ -35,5 +35,5 @@ unitTest( * pound_#.txt file:///D:/weird_names/pound_%23.txt * swapped_surrogate_pair_��.txt file:///D:/weird_names/swapped_surrogate_pair_%EF%BF%BD%EF%BF%BD.txt */ - } + }, ); diff --git a/cli/tests/unit/performance_test.ts b/cli/tests/unit/performance_test.ts index cf3c86517..3c98e4e40 100644 --- a/cli/tests/unit/performance_test.ts +++ b/cli/tests/unit/performance_test.ts @@ -47,11 +47,11 @@ unitTest(function performanceMeasure() { assertEquals(mark.startTime, measure.startTime); assert( measure.duration >= 100, - `duration below 100ms: ${measure.duration}` + `duration below 100ms: ${measure.duration}`, ); assert( measure.duration < 500, - `duration exceeds 500ms: ${measure.duration}` + `duration exceeds 500ms: ${measure.duration}`, ); const entries = performance.getEntries(); assert(entries[entries.length - 1] === measure); diff --git a/cli/tests/unit/process_test.ts b/cli/tests/unit/process_test.ts index 7cb9d9ba5..966a9425b 100644 --- a/cli/tests/unit/process_test.ts +++ b/cli/tests/unit/process_test.ts @@ -78,7 +78,7 @@ unitTest( assertEquals(status.code, 42); assertEquals(status.signal, undefined); p.close(); - } + }, ); unitTest( @@ -96,7 +96,7 @@ unitTest( assertEquals(status.code, 128 + 9); assertEquals(status.signal, 9); p.close(); - } + }, ); unitTest({ perms: { run: true } }, function runNotFound(): void { @@ -150,7 +150,7 @@ while True: assertEquals(status.code, code); assertEquals(status.signal, undefined); p.close(); - } + }, ); unitTest({ perms: { run: true } }, async function runStdinPiped(): Promise< @@ -289,7 +289,7 @@ unitTest( assertStringContains(text, "error"); assertStringContains(text, "output"); - } + }, ); unitTest( @@ -310,7 +310,7 @@ unitTest( assertEquals(status.code, 0); p.close(); file.close(); - } + }, ); unitTest({ perms: { run: true } }, async function runEnv(): Promise<void> { diff --git a/cli/tests/unit/read_dir_test.ts b/cli/tests/unit/read_dir_test.ts index de4b217bf..97c45dac3 100644 --- a/cli/tests/unit/read_dir_test.ts +++ b/cli/tests/unit/read_dir_test.ts @@ -63,9 +63,9 @@ unitTest({ perms: { read: true } }, async function readDirWithUrl(): Promise< void > { const files = []; - for await (const dirEntry of Deno.readDir( - pathToAbsoluteFileUrl("cli/tests") - )) { + for await ( + const dirEntry of Deno.readDir(pathToAbsoluteFileUrl("cli/tests")) + ) { files.push(dirEntry); } assertSameContent(files); diff --git a/cli/tests/unit/read_file_test.ts b/cli/tests/unit/read_file_test.ts index 28407cf24..06141002d 100644 --- a/cli/tests/unit/read_file_test.ts +++ b/cli/tests/unit/read_file_test.ts @@ -19,7 +19,7 @@ unitTest({ perms: { read: true } }, function readFileSyncSuccess(): void { unitTest({ perms: { read: true } }, function readFileSyncUrl(): void { const data = Deno.readFileSync( - pathToAbsoluteFileUrl("cli/tests/fixture.json") + pathToAbsoluteFileUrl("cli/tests/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); @@ -44,7 +44,7 @@ unitTest({ perms: { read: true } }, async function readFileUrl(): Promise< void > { const data = await Deno.readFile( - pathToAbsoluteFileUrl("cli/tests/fixture.json") + pathToAbsoluteFileUrl("cli/tests/fixture.json"), ); assert(data.byteLength > 0); const decoder = new TextDecoder("utf-8"); diff --git a/cli/tests/unit/read_link_test.ts b/cli/tests/unit/read_link_test.ts index 597541914..a4baeb792 100644 --- a/cli/tests/unit/read_link_test.ts +++ b/cli/tests/unit/read_link_test.ts @@ -10,15 +10,15 @@ unitTest( { perms: { write: true, read: true } }, function readLinkSyncSuccess(): void { const testDir = Deno.makeTempDirSync(); - const target = - testDir + (Deno.build.os == "windows" ? "\\target" : "/target"); - const symlink = - testDir + (Deno.build.os == "windows" ? "\\symlink" : "/symlink"); + const target = testDir + + (Deno.build.os == "windows" ? "\\target" : "/target"); + const symlink = testDir + + (Deno.build.os == "windows" ? "\\symlink" : "/symlink"); Deno.mkdirSync(target); Deno.symlinkSync(target, symlink); const targetPath = Deno.readLinkSync(symlink); assertEquals(targetPath, target); - } + }, ); unitTest({ perms: { read: false } }, function readLinkSyncPerm(): void { @@ -37,15 +37,15 @@ unitTest( { perms: { write: true, read: true } }, async function readLinkSuccess(): Promise<void> { const testDir = Deno.makeTempDirSync(); - const target = - testDir + (Deno.build.os == "windows" ? "\\target" : "/target"); - const symlink = - testDir + (Deno.build.os == "windows" ? "\\symlink" : "/symlink"); + const target = testDir + + (Deno.build.os == "windows" ? "\\target" : "/target"); + const symlink = testDir + + (Deno.build.os == "windows" ? "\\symlink" : "/symlink"); Deno.mkdirSync(target); Deno.symlinkSync(target, symlink); const targetPath = await Deno.readLink(symlink); assertEquals(targetPath, target); - } + }, ); unitTest({ perms: { read: false } }, async function readLinkPerm(): Promise< diff --git a/cli/tests/unit/read_text_file_test.ts b/cli/tests/unit/read_text_file_test.ts index 4222da5a9..98275f781 100644 --- a/cli/tests/unit/read_text_file_test.ts +++ b/cli/tests/unit/read_text_file_test.ts @@ -16,7 +16,7 @@ unitTest({ perms: { read: true } }, function readTextFileSyncSuccess(): void { unitTest({ perms: { read: true } }, function readTextFileSyncByUrl(): void { const data = Deno.readTextFileSync( - pathToAbsoluteFileUrl("cli/tests/fixture.json") + pathToAbsoluteFileUrl("cli/tests/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); @@ -42,14 +42,14 @@ unitTest( assert(data.length > 0); const pkg = JSON.parse(data); assertEquals(pkg.name, "deno"); - } + }, ); unitTest({ perms: { read: true } }, async function readTextFileByUrl(): Promise< void > { const data = await Deno.readTextFile( - pathToAbsoluteFileUrl("cli/tests/fixture.json") + pathToAbsoluteFileUrl("cli/tests/fixture.json"), ); assert(data.length > 0); const pkg = JSON.parse(data); diff --git a/cli/tests/unit/real_path_test.ts b/cli/tests/unit/real_path_test.ts index 6e754e3ee..1036f6132 100644 --- a/cli/tests/unit/real_path_test.ts +++ b/cli/tests/unit/real_path_test.ts @@ -34,7 +34,7 @@ unitTest( assert(/^[A-Z]/.test(targetPath)); } assert(targetPath.endsWith("/target")); - } + }, ); unitTest({ perms: { read: false } }, function realPathSyncPerm(): void { @@ -79,7 +79,7 @@ unitTest( assert(/^[A-Z]/.test(targetPath)); } assert(targetPath.endsWith("/target")); - } + }, ); unitTest({ perms: { read: false } }, async function realPathPerm(): Promise< diff --git a/cli/tests/unit/remove_test.ts b/cli/tests/unit/remove_test.ts index 42160af5c..14c960da5 100644 --- a/cli/tests/unit/remove_test.ts +++ b/cli/tests/unit/remove_test.ts @@ -23,7 +23,7 @@ unitTest( Deno.statSync(path); }, Deno.errors.NotFound); } - } + }, ); unitTest( @@ -43,7 +43,7 @@ unitTest( Deno.statSync(filename); }, Deno.errors.NotFound); } - } + }, ); unitTest( @@ -56,7 +56,7 @@ unitTest( const tempDir = Deno.makeTempDirSync(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt`, ); Deno.writeFileSync(fileUrl, data, { mode: 0o666 }); @@ -68,7 +68,7 @@ unitTest( Deno.statSync(fileUrl); }, Deno.errors.NotFound); } - } + }, ); unitTest( @@ -95,7 +95,7 @@ unitTest( await Deno[method]("/baddir"); }, Deno.errors.NotFound); } - } + }, ); unitTest( @@ -117,7 +117,7 @@ unitTest( Deno.lstatSync(danglingSymlinkPath); }, Deno.errors.NotFound); } - } + }, ); unitTest( @@ -143,7 +143,7 @@ unitTest( }, Deno.errors.NotFound); await Deno[method](filePath); } - } + }, ); unitTest({ perms: { write: false } }, async function removePerm(): Promise< @@ -171,7 +171,7 @@ unitTest( () => { Deno.statSync(path); }, // Directory is gone - Deno.errors.NotFound + Deno.errors.NotFound, ); // REMOVE NON-EMPTY DIRECTORY @@ -190,7 +190,7 @@ unitTest( }, Deno.errors.NotFound); // Directory is gone } - } + }, ); unitTest( @@ -211,7 +211,7 @@ unitTest( }, Deno.errors.NotFound); // File is gone } - } + }, ); unitTest({ perms: { write: true } }, async function removeAllFail(): Promise< @@ -254,7 +254,7 @@ unitTest( Deno.statSync(path); }, Deno.errors.NotFound); } - } + }, ); if (Deno.build.os === "windows") { @@ -272,7 +272,7 @@ if (Deno.build.os === "windows") { await assertThrowsAsync(async () => { await Deno.lstat("file_link"); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -290,6 +290,6 @@ if (Deno.build.os === "windows") { await assertThrowsAsync(async () => { await Deno.lstat("dir_link"); }, Deno.errors.NotFound); - } + }, ); } diff --git a/cli/tests/unit/rename_test.ts b/cli/tests/unit/rename_test.ts index 38a259782..dfde8dc05 100644 --- a/cli/tests/unit/rename_test.ts +++ b/cli/tests/unit/rename_test.ts @@ -37,7 +37,7 @@ unitTest( Deno.renameSync(oldpath, newpath); assertDirectory(newpath); assertMissing(oldpath); - } + }, ); unitTest( @@ -48,7 +48,7 @@ unitTest( const newpath = "/newbaddir"; Deno.renameSync(oldpath, newpath); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -59,7 +59,7 @@ unitTest( const newpath = "/newbaddir"; Deno.renameSync(oldpath, newpath); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -72,7 +72,7 @@ unitTest( await Deno.rename(oldpath, newpath); assertDirectory(newpath); assertMissing(oldpath); - } + }, ); function readFileString(filename: string): string { @@ -107,21 +107,21 @@ unitTest( Deno.renameSync(oldfile, emptydir); }, Error, - "Is a directory" + "Is a directory", ); assertThrows( (): void => { Deno.renameSync(olddir, fulldir); }, Error, - "Directory not empty" + "Directory not empty", ); assertThrows( (): void => { Deno.renameSync(olddir, file); }, Error, - "Not a directory" + "Not a directory", ); const fileLink = testDir + "/fileLink"; @@ -136,21 +136,21 @@ unitTest( Deno.renameSync(olddir, fileLink); }, Error, - "Not a directory" + "Not a directory", ); assertThrows( (): void => { Deno.renameSync(olddir, dirLink); }, Error, - "Not a directory" + "Not a directory", ); assertThrows( (): void => { Deno.renameSync(olddir, danglingLink); }, Error, - "Not a directory" + "Not a directory", ); // should succeed on Unix @@ -159,7 +159,7 @@ unitTest( Deno.renameSync(dirLink, danglingLink); assertFile(danglingLink); assertEquals("Hello", readFileString(danglingLink)); - } + }, ); unitTest( @@ -182,25 +182,25 @@ unitTest( Deno.renameSync(oldfile, emptydir); }, Deno.errors.PermissionDenied, - "Access is denied" + "Access is denied", ); assertThrows( (): void => { Deno.renameSync(olddir, fulldir); }, Deno.errors.PermissionDenied, - "Access is denied" + "Access is denied", ); assertThrows( (): void => { Deno.renameSync(olddir, emptydir); }, Deno.errors.PermissionDenied, - "Access is denied" + "Access is denied", ); // should succeed on Windows Deno.renameSync(olddir, file); assertDirectory(file); - } + }, ); diff --git a/cli/tests/unit/resources_test.ts b/cli/tests/unit/resources_test.ts index e4d420055..5742fd6a0 100644 --- a/cli/tests/unit/resources_test.ts +++ b/cli/tests/unit/resources_test.ts @@ -25,10 +25,10 @@ unitTest({ perms: { net: true } }, async function resourcesNet(): Promise< const res = Deno.resources(); assertEquals( Object.values(res).filter((r): boolean => r === "tcpListener").length, - 1 + 1, ); const tcpStreams = Object.values(res).filter( - (r): boolean => r === "tcpStream" + (r): boolean => r === "tcpStream", ); assert(tcpStreams.length >= 2); @@ -48,7 +48,7 @@ unitTest({ perms: { read: true } }, async function resourcesFile(): Promise< // check that exactly one new resource (file) was added assertEquals( Object.keys(resourcesAfter).length, - Object.keys(resourcesBefore).length + 1 + Object.keys(resourcesBefore).length + 1, ); const newRid = +Object.keys(resourcesAfter).find((rid): boolean => { return !resourcesBefore.hasOwnProperty(rid); diff --git a/cli/tests/unit/signal_test.ts b/cli/tests/unit/signal_test.ts index 2f117f8d1..98eac6e0b 100644 --- a/cli/tests/unit/signal_test.ts +++ b/cli/tests/unit/signal_test.ts @@ -21,86 +21,86 @@ unitTest( Deno.signal(1); }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.alarm(); // for SIGALRM }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.child(); // for SIGCHLD }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.hungup(); // for SIGHUP }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.interrupt(); // for SIGINT }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.io(); // for SIGIO }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.pipe(); // for SIGPIPE }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.quit(); // for SIGQUIT }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.terminate(); // for SIGTERM }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.userDefined1(); // for SIGUSR1 }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.userDefined2(); // for SIGURS2 }, Error, - "not implemented" + "not implemented", ); assertThrows( () => { Deno.signals.windowChange(); // for SIGWINCH }, Error, - "not implemented" + "not implemented", ); - } + }, ); unitTest( @@ -131,7 +131,7 @@ unitTest( clearInterval(t); await resolvable; - } + }, ); unitTest( @@ -151,7 +151,7 @@ unitTest( clearInterval(t); await resolvable; - } + }, ); unitTest( @@ -191,5 +191,5 @@ unitTest( s = Deno.signals.windowChange(); // for SIGWINCH assert(s instanceof Deno.SignalStream); s.dispose(); - } + }, ); diff --git a/cli/tests/unit/stat_test.ts b/cli/tests/unit/stat_test.ts index 48142bc12..092724395 100644 --- a/cli/tests/unit/stat_test.ts +++ b/cli/tests/unit/stat_test.ts @@ -59,7 +59,7 @@ unitTest( assert(tempInfo.atime !== null && now - tempInfo.atime.valueOf() < 1000); assert(tempInfo.mtime !== null && now - tempInfo.mtime.valueOf() < 1000); assert( - tempInfo.birthtime === null || now - tempInfo.birthtime.valueOf() < 1000 + tempInfo.birthtime === null || now - tempInfo.birthtime.valueOf() < 1000, ); const packageInfoByUrl = Deno.statSync(pathToAbsoluteFileUrl("README.md")); @@ -67,7 +67,7 @@ unitTest( assert(!packageInfoByUrl.isSymlink); const modulesInfoByUrl = Deno.statSync( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir") + pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), ); assert(modulesInfoByUrl.isDirectory); assert(!modulesInfoByUrl.isSymlink); @@ -79,24 +79,26 @@ unitTest( const tempFileForUrl = Deno.makeTempFileSync(); const tempInfoByUrl = Deno.statSync( new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempFileForUrl}` - ) + `file://${Deno.build.os === "windows" ? "/" : ""}${tempFileForUrl}`, + ), ); now = Date.now(); assert( - tempInfoByUrl.atime !== null && now - tempInfoByUrl.atime.valueOf() < 1000 + tempInfoByUrl.atime !== null && + now - tempInfoByUrl.atime.valueOf() < 1000, ); assert( - tempInfoByUrl.mtime !== null && now - tempInfoByUrl.mtime.valueOf() < 1000 + tempInfoByUrl.mtime !== null && + now - tempInfoByUrl.mtime.valueOf() < 1000, ); assert( tempInfoByUrl.birthtime === null || - now - tempInfoByUrl.birthtime.valueOf() < 1000 + now - tempInfoByUrl.birthtime.valueOf() < 1000, ); Deno.removeSync(tempFile, { recursive: true }); Deno.removeSync(tempFileForUrl, { recursive: true }); - } + }, ); unitTest({ perms: { read: false } }, function statSyncPerm(): void { @@ -125,7 +127,7 @@ unitTest({ perms: { read: true } }, function lstatSyncSuccess(): void { assert(modulesInfo.isSymlink); const modulesInfoByUrl = Deno.lstatSync( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir") + pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), ); assert(!modulesInfoByUrl.isDirectory); assert(modulesInfoByUrl.isSymlink); @@ -159,7 +161,7 @@ unitTest( assert(!packageInfo.isSymlink); const packageInfoByUrl = await Deno.stat( - pathToAbsoluteFileUrl("README.md") + pathToAbsoluteFileUrl("README.md"), ); assert(packageInfoByUrl.isFile); assert(!packageInfoByUrl.isSymlink); @@ -169,7 +171,7 @@ unitTest( assert(!modulesInfo.isSymlink); const modulesInfoByUrl = await Deno.stat( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir") + pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), ); assert(modulesInfoByUrl.isDirectory); assert(!modulesInfoByUrl.isSymlink); @@ -189,30 +191,32 @@ unitTest( assert(tempInfo.mtime !== null && now - tempInfo.mtime.valueOf() < 1000); assert( - tempInfo.birthtime === null || now - tempInfo.birthtime.valueOf() < 1000 + tempInfo.birthtime === null || now - tempInfo.birthtime.valueOf() < 1000, ); const tempFileForUrl = await Deno.makeTempFile(); const tempInfoByUrl = await Deno.stat( new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempFileForUrl}` - ) + `file://${Deno.build.os === "windows" ? "/" : ""}${tempFileForUrl}`, + ), ); now = Date.now(); assert( - tempInfoByUrl.atime !== null && now - tempInfoByUrl.atime.valueOf() < 1000 + tempInfoByUrl.atime !== null && + now - tempInfoByUrl.atime.valueOf() < 1000, ); assert( - tempInfoByUrl.mtime !== null && now - tempInfoByUrl.mtime.valueOf() < 1000 + tempInfoByUrl.mtime !== null && + now - tempInfoByUrl.mtime.valueOf() < 1000, ); assert( tempInfoByUrl.birthtime === null || - now - tempInfoByUrl.birthtime.valueOf() < 1000 + now - tempInfoByUrl.birthtime.valueOf() < 1000, ); Deno.removeSync(tempFile, { recursive: true }); Deno.removeSync(tempFileForUrl, { recursive: true }); - } + }, ); unitTest({ perms: { read: false } }, async function statPerm(): Promise<void> { @@ -227,7 +231,7 @@ unitTest({ perms: { read: true } }, async function statNotFound(): Promise< await assertThrowsAsync( async (): Promise<void> => { await Deno.stat("bad_file_name"), Deno.errors.NotFound; - } + }, ); }); @@ -247,7 +251,7 @@ unitTest({ perms: { read: true } }, async function lstatSuccess(): Promise< assert(modulesInfo.isSymlink); const modulesInfoByUrl = await Deno.lstat( - pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir") + pathToAbsoluteFileUrl("cli/tests/symlink_to_subdir"), ); assert(!modulesInfoByUrl.isDirectory); assert(modulesInfoByUrl.isSymlink); @@ -293,7 +297,7 @@ unitTest( assert(s.rdev === null); assert(s.blksize === null); assert(s.blocks === null); - } + }, ); unitTest( @@ -317,5 +321,5 @@ unitTest( assert(s.rdev !== null); assert(s.blksize !== null); assert(s.blocks !== null); - } + }, ); diff --git a/cli/tests/unit/streams_internal_test.ts b/cli/tests/unit/streams_internal_test.ts index 346ec27af..caeab431d 100644 --- a/cli/tests/unit/streams_internal_test.ts +++ b/cli/tests/unit/streams_internal_test.ts @@ -10,7 +10,7 @@ unitTest(function streamReadableHwmError() { new ReadableStream<number>(undefined, { highWaterMark }); }, RangeError, - "highWaterMark must be a positive number or Infinity. Received:" + "highWaterMark must be a positive number or Infinity. Received:", ); } @@ -18,7 +18,7 @@ unitTest(function streamReadableHwmError() { new ReadableStream<number>( undefined, // eslint-disable-next-line @typescript-eslint/no-explicit-any - { highWaterMark: Symbol("hwk") as any } + { highWaterMark: Symbol("hwk") as any }, ); }, TypeError); }); @@ -31,11 +31,11 @@ unitTest(function streamWriteableHwmError() { () => { new WritableStream( undefined, - new CountQueuingStrategy({ highWaterMark }) + new CountQueuingStrategy({ highWaterMark }), ); }, RangeError, - "highWaterMark must be a positive number or Infinity. Received:" + "highWaterMark must be a positive number or Infinity. Received:", ); } @@ -43,7 +43,7 @@ unitTest(function streamWriteableHwmError() { new WritableStream( undefined, // eslint-disable-next-line @typescript-eslint/no-explicit-any - new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") as any }) + new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") as any }), ); }, TypeError); }); @@ -57,7 +57,7 @@ unitTest(function streamTransformHwmError() { new TransformStream(undefined, undefined, { highWaterMark }); }, RangeError, - "highWaterMark must be a positive number or Infinity. Received:" + "highWaterMark must be a positive number or Infinity. Received:", ); } @@ -66,7 +66,7 @@ unitTest(function streamTransformHwmError() { undefined, undefined, // eslint-disable-next-line @typescript-eslint/no-explicit-any - { highWaterMark: Symbol("hwmk") as any } + { highWaterMark: Symbol("hwmk") as any }, ); }, TypeError); }); diff --git a/cli/tests/unit/streams_piping_test.ts b/cli/tests/unit/streams_piping_test.ts index a947b3821..0696021cb 100644 --- a/cli/tests/unit/streams_piping_test.ts +++ b/cli/tests/unit/streams_piping_test.ts @@ -72,7 +72,7 @@ unitTest(async function streamPipeLotsOfChunks() { written.push("closed"); }, }, - new CountQueuingStrategy({ highWaterMark: CHUNKS }) + new CountQueuingStrategy({ highWaterMark: CHUNKS }), ); await rs.pipeTo(ws); @@ -101,7 +101,7 @@ for (const preventAbort of [true, false]) { throw new Error("pipeTo promise should be rejected"); }, (value) => - assertEquals(value, undefined, "rejection value should be undefined") + assertEquals(value, undefined, "rejection value should be undefined"), ); }); } @@ -125,7 +125,7 @@ for (const preventCancel of [true, false]) { throw new Error("pipeTo promise should be rejected"); }, (value) => - assertEquals(value, undefined, "rejection value should be undefined") + assertEquals(value, undefined, "rejection value should be undefined"), ); }); } diff --git a/cli/tests/unit/streams_transform_test.ts b/cli/tests/unit/streams_transform_test.ts index c8b4528e8..fa321daf2 100644 --- a/cli/tests/unit/streams_transform_test.ts +++ b/cli/tests/unit/streams_transform_test.ts @@ -17,7 +17,7 @@ function delay(seconds: number): Promise<void> { function readableStreamToArray<R>( readable: { getReader(): ReadableStreamDefaultReader<R> }, - reader?: ReadableStreamDefaultReader<R> + reader?: ReadableStreamDefaultReader<R>, ): Promise<R[]> { if (reader === undefined) { reader = readable.getReader(); @@ -58,21 +58,21 @@ unitTest(function transformStreamIntstancesHaveProperProperties() { assertEquals( typeof writableStream.get, "function", - "writable should have a getter" + "writable should have a getter", ); assertEquals( writableStream.set, undefined, - "writable should not have a setter" + "writable should not have a setter", ); assert(writableStream.configurable, "writable should be configurable"); assert( ts.writable instanceof WritableStream, - "writable is an instance of WritableStream" + "writable is an instance of WritableStream", ); assert( WritableStream.prototype.getWriter.call(ts.writable), - "writable should pass WritableStream brand check" + "writable should pass WritableStream brand check", ); const readableStream = Object.getOwnPropertyDescriptor(proto, "readable"); @@ -81,22 +81,22 @@ unitTest(function transformStreamIntstancesHaveProperProperties() { assertEquals( typeof readableStream.get, "function", - "readable should have a getter" + "readable should have a getter", ); assertEquals( readableStream.set, undefined, - "readable should not have a setter" + "readable should not have a setter", ); assert(readableStream.configurable, "readable should be configurable"); assert( ts.readable instanceof ReadableStream, - "readable is an instance of ReadableStream" + "readable is an instance of ReadableStream", ); assertNotEquals( ReadableStream.prototype.getReader.call(ts.readable), undefined, - "readable should pass ReadableStream brand check" + "readable should pass ReadableStream brand check", ); }); @@ -115,14 +115,14 @@ unitTest(async function transformStreamReadableCanReadOutOfWritable() { assertEquals( writer.desiredSize, 0, - "writer.desiredSize should be 0 after write()" + "writer.desiredSize should be 0 after write()", ); const result = await ts.readable.getReader().read(); assertEquals( result.value, "a", - "result from reading the readable is the same as was written to writable" + "result from reading the readable is the same as was written to writable", ); assert(!result.done, "stream should not be done"); @@ -148,7 +148,7 @@ unitTest(async function transformStreamCanReadWhatIsWritten() { assertEquals( result.value, "A", - "result from reading the readable is the transformation of what was written to writable" + "result from reading the readable is the transformation of what was written to writable", ); assert(!result.done, "stream should not be done"); }); @@ -174,7 +174,7 @@ unitTest(async function transformStreamCanReadBothChunks() { assertEquals( result1.value, "A", - "the first chunk read is the transformation of the single chunk written" + "the first chunk read is the transformation of the single chunk written", ); assert(!result1.done, "stream should not be done"); @@ -182,7 +182,7 @@ unitTest(async function transformStreamCanReadBothChunks() { assertEquals( result2.value, "A", - "the second chunk read is also the transformation of the single chunk written" + "the second chunk read is also the transformation of the single chunk written", ); assert(!result2.done, "stream should not be done"); }); @@ -205,7 +205,7 @@ unitTest(async function transformStreamCanReadWhatIsWritten() { assertEquals( result.value, "A", - "result from reading the readable is the transformation of what was written to writable" + "result from reading the readable is the transformation of what was written to writable", ); assert(!result.done, "stream should not be done"); }); @@ -216,7 +216,7 @@ unitTest(async function transformStreamAsyncReadMultipleChunks() { const ts = new TransformStream({ transform( chunk: string, - controller: TransformStreamDefaultController + controller: TransformStreamDefaultController, ): Promise<void> { delay(0).then(() => controller.enqueue(chunk.toUpperCase())); doSecondEnqueue = (): void => controller.enqueue(chunk.toUpperCase()); @@ -235,7 +235,7 @@ unitTest(async function transformStreamAsyncReadMultipleChunks() { assertEquals( result1.value, "A", - "the first chunk read is the transformation of the single chunk written" + "the first chunk read is the transformation of the single chunk written", ); assert(!result1.done, "stream should not be done"); doSecondEnqueue!(); @@ -244,7 +244,7 @@ unitTest(async function transformStreamAsyncReadMultipleChunks() { assertEquals( result2.value, "A", - "the second chunk read is also the transformation of the single chunk written" + "the second chunk read is also the transformation of the single chunk written", ); assert(!result2.done, "stream should not be done"); returnFromTransform!(); @@ -257,7 +257,7 @@ unitTest(function transformStreamClosingWriteClosesRead() { writer.close(); return Promise.all([writer.closed, ts.readable.getReader().closed]).then( - undefined + undefined, ); }); @@ -273,7 +273,7 @@ unitTest(async function transformStreamCloseWaitAwaitsTransforms() { }, }, undefined, - { highWaterMark: 1 } + { highWaterMark: 1 }, ); const writer = ts.writable.getWriter(); @@ -318,7 +318,7 @@ unitTest(async function transformStreamCloseWriteAfterSyncEnqueues() { assertEquals( chunks, ["x", "y"], - "both enqueued chunks can be read from the readable" + "both enqueued chunks can be read from the readable", ); }); @@ -347,7 +347,7 @@ unitTest(async function transformStreamWritableCloseAsyncAfterAsyncEnqueues() { assertEquals( chunks, ["x", "y"], - "both enqueued chunks can be read from the readable" + "both enqueued chunks can be read from the readable", ); }); @@ -382,7 +382,7 @@ unitTest(async function transformStreamTransformerMethodsCalledAsMethods() { assertEquals( chunks, ["start-suffix", "a-suffix", "flushed-suffix"], - "all enqueued chunks have suffixes" + "all enqueued chunks have suffixes", ); }); @@ -415,7 +415,7 @@ unitTest(async function transformStreamCallTransformSync() { }, }, undefined, - { highWaterMark: Infinity } + { highWaterMark: Infinity }, ); // transform() is only called synchronously when there is no backpressure and // all microtasks have run. @@ -432,7 +432,7 @@ unitTest(function transformStreamCloseWriteCloesesReadWithNoChunks() { writer.close(); return Promise.all([writer.closed, ts.readable.getReader().closed]).then( - undefined + undefined, ); }); @@ -459,7 +459,7 @@ unitTest(function transformStreamEnqueueThrowsAfterReadableCancel() { () => controller.enqueue(undefined), TypeError, undefined, - "enqueue should throw" + "enqueue should throw", ); return cancelPromise; }); @@ -510,7 +510,7 @@ unitTest(function transformStreamReadableTypeThrows() { () => new TransformStream({ readableType: "bytes" as any }), RangeError, undefined, - "constructor should throw" + "constructor should throw", ); }); @@ -520,7 +520,7 @@ unitTest(function transformStreamWirtableTypeThrows() { () => new TransformStream({ writableType: "bytes" as any }), RangeError, undefined, - "constructor should throw" + "constructor should throw", ); }); @@ -532,31 +532,31 @@ unitTest(function transformStreamSubclassable() { } assert( Object.getPrototypeOf(Subclass.prototype) === TransformStream.prototype, - "Subclass.prototype's prototype should be TransformStream.prototype" + "Subclass.prototype's prototype should be TransformStream.prototype", ); assert( Object.getPrototypeOf(Subclass) === TransformStream, - "Subclass's prototype should be TransformStream" + "Subclass's prototype should be TransformStream", ); const sub = new Subclass(); assert( sub instanceof TransformStream, - "Subclass object should be an instance of TransformStream" + "Subclass object should be an instance of TransformStream", ); assert( sub instanceof Subclass, - "Subclass object should be an instance of Subclass" + "Subclass object should be an instance of Subclass", ); const readableGetter = Object.getOwnPropertyDescriptor( TransformStream.prototype, - "readable" + "readable", )!.get; assert( readableGetter!.call(sub) === sub.readable, - "Subclass object should pass brand check" + "Subclass object should pass brand check", ); assert( sub.extraFunction(), - "extraFunction() should be present on Subclass object" + "extraFunction() should be present on Subclass object", ); }); diff --git a/cli/tests/unit/streams_writable_test.ts b/cli/tests/unit/streams_writable_test.ts index 54c1624af..a06b15c7e 100644 --- a/cli/tests/unit/streams_writable_test.ts +++ b/cli/tests/unit/streams_writable_test.ts @@ -79,7 +79,7 @@ unitTest(function getWriterOnErroredStream() { () => { writer.releaseLock(); ws.getWriter(); - } + }, ); }); @@ -97,7 +97,7 @@ unitTest(function closedAndReadyOnReleasedWriter() { assertEquals( closedRejection.name, "TypeError", - "closed promise should reject with a TypeError" + "closed promise should reject with a TypeError", ); return writer.ready.then( (v) => { @@ -107,10 +107,10 @@ unitTest(function closedAndReadyOnReleasedWriter() { assertEquals( readyRejection, closedRejection, - "ready promise should reject with the same error" - ) + "ready promise should reject with the same error", + ), ); - } + }, ); }); @@ -173,13 +173,13 @@ unitTest(function redundantReleaseLockIsNoOp() { assertEquals( undefined, writer1.releaseLock(), - "releaseLock() should return undefined" + "releaseLock() should return undefined", ); const writer2 = ws.getWriter(); assertEquals( undefined, writer1.releaseLock(), - "no-op releaseLock() should return undefined" + "no-op releaseLock() should return undefined", ); // Calling releaseLock() on writer1 should not interfere with writer2. If it did, then the ready promise would be // rejected. @@ -200,7 +200,7 @@ unitTest(function readyPromiseShouldFireBeforeReleaseLock() { assertEquals( events, ["ready", "closed"], - "ready promise should fire before closed promise" + "ready promise should fire before closed promise", ); // Stop the writer promise hanging around after the test has finished. return Promise.all([writerPromise, ws.abort()]).then(undefined); @@ -216,32 +216,32 @@ unitTest(function subclassingWritableStream() { } assert( Object.getPrototypeOf(Subclass.prototype) === WritableStream.prototype, - "Subclass.prototype's prototype should be WritableStream.prototype" + "Subclass.prototype's prototype should be WritableStream.prototype", ); assert( Object.getPrototypeOf(Subclass) === WritableStream, - "Subclass's prototype should be WritableStream" + "Subclass's prototype should be WritableStream", ); const sub = new Subclass(); assert( sub instanceof WritableStream, - "Subclass object should be an instance of WritableStream" + "Subclass object should be an instance of WritableStream", ); assert( sub instanceof Subclass, - "Subclass object should be an instance of Subclass" + "Subclass object should be an instance of Subclass", ); const lockedGetter = Object.getOwnPropertyDescriptor( WritableStream.prototype, - "locked" + "locked", )!.get!; assert( lockedGetter.call(sub) === sub.locked, - "Subclass object should pass brand check" + "Subclass object should pass brand check", ); assert( sub.extraFunction(), - "extraFunction() should be present on Subclass object" + "extraFunction() should be present on Subclass object", ); }); diff --git a/cli/tests/unit/symlink_test.ts b/cli/tests/unit/symlink_test.ts index 8949faa0c..b7babc88a 100644 --- a/cli/tests/unit/symlink_test.ts +++ b/cli/tests/unit/symlink_test.ts @@ -13,7 +13,7 @@ unitTest( const newNameInfoStat = Deno.statSync(newname); assert(newNameInfoLStat.isSymlink); assert(newNameInfoStat.isDirectory); - } + }, ); unitTest(function symlinkSyncPerm(): void { @@ -34,5 +34,5 @@ unitTest( const newNameInfoStat = Deno.statSync(newname); assert(newNameInfoLStat.isSymlink, "NOT SYMLINK"); assert(newNameInfoStat.isDirectory, "NOT DIRECTORY"); - } + }, ); diff --git a/cli/tests/unit/sync_test.ts b/cli/tests/unit/sync_test.ts index fd6acd858..d16ab60d4 100644 --- a/cli/tests/unit/sync_test.ts +++ b/cli/tests/unit/sync_test.ts @@ -16,7 +16,7 @@ unitTest( assertEquals(Deno.readFileSync(filename), data); Deno.close(file.rid); Deno.removeSync(filename); - } + }, ); unitTest( @@ -34,7 +34,7 @@ unitTest( assertEquals(await Deno.readFile(filename), data); Deno.close(file.rid); await Deno.remove(filename); - } + }, ); unitTest( @@ -52,7 +52,7 @@ unitTest( assertEquals(Deno.statSync(filename).size, size); Deno.close(file.rid); Deno.removeSync(filename); - } + }, ); unitTest( @@ -70,5 +70,5 @@ unitTest( assertEquals((await Deno.stat(filename)).size, size); Deno.close(file.rid); await Deno.remove(filename); - } + }, ); diff --git a/cli/tests/unit/test_util.ts b/cli/tests/unit/test_util.ts index 25da7a638..865b6e061 100644 --- a/cli/tests/unit/test_util.ts +++ b/cli/tests/unit/test_util.ts @@ -58,12 +58,12 @@ export async function getProcessPermissions(): Promise<Permissions> { export function permissionsMatch( processPerms: Permissions, - requiredPerms: Permissions + requiredPerms: Permissions, ): boolean { for (const permName in processPerms) { if ( processPerms[permName as keyof Permissions] !== - requiredPerms[permName as keyof Permissions] + requiredPerms[permName as keyof Permissions] ) { return false; } @@ -148,7 +148,7 @@ export function unitTest(fn: TestFunction): void; export function unitTest(options: UnitTestOptions, fn: TestFunction): void; export function unitTest( optionsOrFn: UnitTestOptions | TestFunction, - maybeFn?: TestFunction + maybeFn?: TestFunction, ): void { assert(optionsOrFn, "At least one argument is required"); @@ -166,7 +166,7 @@ export function unitTest( assert(maybeFn, "Missing test function definition"); assert( typeof maybeFn === "function", - "Second argument should be test function definition" + "Second argument should be test function definition", ); fn = maybeFn; name = fn.name; @@ -237,7 +237,7 @@ function serializeTestMessage(message: any): string { export async function reportToConn( conn: Deno.Conn, // eslint-disable-next-line @typescript-eslint/no-explicit-any - message: any + message: any, ): Promise<void> { const line = serializeTestMessage(message); const encodedMsg = encoder.encode(line + (message.end == null ? "\n" : "")); @@ -259,8 +259,8 @@ unitTest(function permissionsMatches(): void { plugin: false, hrtime: false, }, - normalizeTestPermissions({ read: true }) - ) + normalizeTestPermissions({ read: true }), + ), ); assert( @@ -274,8 +274,8 @@ unitTest(function permissionsMatches(): void { plugin: false, hrtime: false, }, - normalizeTestPermissions({}) - ) + normalizeTestPermissions({}), + ), ); assertEquals( @@ -289,9 +289,9 @@ unitTest(function permissionsMatches(): void { plugin: true, hrtime: true, }, - normalizeTestPermissions({ read: true }) + normalizeTestPermissions({ read: true }), ), - false + false, ); assertEquals( @@ -305,9 +305,9 @@ unitTest(function permissionsMatches(): void { plugin: false, hrtime: false, }, - normalizeTestPermissions({ read: true }) + normalizeTestPermissions({ read: true }), ), - false + false, ); assert( @@ -329,8 +329,8 @@ unitTest(function permissionsMatches(): void { run: true, plugin: true, hrtime: true, - } - ) + }, + ), ); }); @@ -348,28 +348,28 @@ unitTest( file!.endsWith(".ts") && !file!.endsWith("unit_tests.ts") && !file!.endsWith("test_util.ts") && - !file!.endsWith("unit_test_runner.ts") + !file!.endsWith("unit_test_runner.ts"), ); const unitTestsFile: Uint8Array = Deno.readFileSync( - "./cli/tests/unit/unit_tests.ts" + "./cli/tests/unit/unit_tests.ts", ); const importLines = new TextDecoder("utf-8") .decode(unitTestsFile) .split("\n") .filter((line) => line.startsWith("import")); const importedTestFiles = importLines.map( - (relativeFilePath) => relativeFilePath.match(/\/([^\/]+)";/)![1] + (relativeFilePath) => relativeFilePath.match(/\/([^\/]+)";/)![1], ); directoryTestFiles.forEach((dirFile) => { if (!importedTestFiles.includes(dirFile!)) { throw new Error( "cil/tests/unit/unit_tests.ts is missing import of test file: cli/js/" + - dirFile + dirFile, ); } }); - } + }, ); export function pathToAbsoluteFileUrl(path: string): URL { diff --git a/cli/tests/unit/testing_test.ts b/cli/tests/unit/testing_test.ts index 854e7161c..9ae547fb8 100644 --- a/cli/tests/unit/testing_test.ts +++ b/cli/tests/unit/testing_test.ts @@ -12,7 +12,7 @@ unitTest(function nameOfTestCaseCantBeEmpty(): void { Deno.test("", () => {}); }, TypeError, - "The test name can't be empty" + "The test name can't be empty", ); assertThrows( () => { @@ -22,6 +22,6 @@ unitTest(function nameOfTestCaseCantBeEmpty(): void { }); }, TypeError, - "The test name can't be empty" + "The test name can't be empty", ); }); diff --git a/cli/tests/unit/text_encoding_test.ts b/cli/tests/unit/text_encoding_test.ts index c87fc705d..e990f1284 100644 --- a/cli/tests/unit/text_encoding_test.ts +++ b/cli/tests/unit/text_encoding_test.ts @@ -58,7 +58,7 @@ unitTest(function btoaFailed(): void { }); unitTest(function textDecoder2(): void { - // prettier-ignore + // deno-fmt-ignore const fixture = new Uint8Array([ 0xf0, 0x9d, 0x93, 0xbd, 0xf0, 0x9d, 0x93, 0xae, @@ -70,7 +70,7 @@ unitTest(function textDecoder2(): void { }); unitTest(function textDecoderIgnoreBOM(): void { - // prettier-ignore + // deno-fmt-ignore const fixture = new Uint8Array([ 0xef, 0xbb, 0xbf, 0xf0, 0x9d, 0x93, 0xbd, @@ -83,7 +83,7 @@ unitTest(function textDecoderIgnoreBOM(): void { }); unitTest(function textDecoderNotBOM(): void { - // prettier-ignore + // deno-fmt-ignore const fixture = new Uint8Array([ 0xef, 0xbb, 0x89, 0xf0, 0x9d, 0x93, 0xbd, @@ -115,7 +115,7 @@ unitTest(function textDecoderErrorEncoding(): void { unitTest(function textEncoder(): void { const fixture = "𝓽𝓮𝔁𝓽"; const encoder = new TextEncoder(); - // prettier-ignore + // deno-fmt-ignore assertEquals(Array.from(encoder.encode(fixture)), [ 0xf0, 0x9d, 0x93, 0xbd, 0xf0, 0x9d, 0x93, 0xae, @@ -131,7 +131,7 @@ unitTest(function textEncodeInto(): void { const result = encoder.encodeInto(fixture, bytes); assertEquals(result.read, 4); assertEquals(result.written, 4); - // prettier-ignore + // deno-fmt-ignore assertEquals(Array.from(bytes), [ 0x74, 0x65, 0x78, 0x74, 0x00, ]); @@ -144,7 +144,7 @@ unitTest(function textEncodeInto2(): void { const result = encoder.encodeInto(fixture, bytes); assertEquals(result.read, 8); assertEquals(result.written, 16); - // prettier-ignore + // deno-fmt-ignore assertEquals(Array.from(bytes), [ 0xf0, 0x9d, 0x93, 0xbd, 0xf0, 0x9d, 0x93, 0xae, @@ -160,7 +160,7 @@ unitTest(function textEncodeInto3(): void { const result = encoder.encodeInto(fixture, bytes); assertEquals(result.read, 2); assertEquals(result.written, 4); - // prettier-ignore + // deno-fmt-ignore assertEquals(Array.from(bytes), [ 0xf0, 0x9d, 0x93, 0xbd, 0x00, ]); diff --git a/cli/tests/unit/timers_test.ts b/cli/tests/unit/timers_test.ts index 8a22173de..b7f6dd520 100644 --- a/cli/tests/unit/timers_test.ts +++ b/cli/tests/unit/timers_test.ts @@ -56,7 +56,7 @@ unitTest(async function timeoutArgs(): Promise<void> { 10, arg, arg.toString(), - [arg] + [arg], ); await promise; }); diff --git a/cli/tests/unit/tls_test.ts b/cli/tests/unit/tls_test.ts index 5a7391e78..ed7466a2c 100644 --- a/cli/tests/unit/tls_test.ts +++ b/cli/tests/unit/tls_test.ts @@ -52,7 +52,7 @@ unitTest( keyFile: "./non/existent/file", }); }, Deno.errors.NotFound); - } + }, ); unitTest({ perms: { net: true } }, function listenTLSNoReadPerm(): void { @@ -90,7 +90,7 @@ unitTest( keyFile: keyFilename, }); }, Error); - } + }, ); unitTest( @@ -115,7 +115,7 @@ unitTest( certFile: certFilename, }); }, Error); - } + }, ); unitTest( @@ -133,7 +133,7 @@ unitTest( }); const response = encoder.encode( - "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n" + "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\nHello World\n", ); listener.accept().then( @@ -146,7 +146,7 @@ unitTest( conn.close(); resolvable.resolve(); }, 0); - } + }, ); const conn = await Deno.connectTls({ @@ -179,7 +179,7 @@ unitTest( conn.close(); listener.close(); await resolvable; - } + }, ); unitTest( @@ -230,5 +230,5 @@ unitTest( } conn.close(); - } + }, ); diff --git a/cli/tests/unit/truncate_test.ts b/cli/tests/unit/truncate_test.ts index 0a7e20ab1..db2cdc4be 100644 --- a/cli/tests/unit/truncate_test.ts +++ b/cli/tests/unit/truncate_test.ts @@ -25,7 +25,7 @@ unitTest( Deno.close(file.rid); Deno.removeSync(filename); - } + }, ); unitTest( @@ -47,7 +47,7 @@ unitTest( Deno.close(file.rid); await Deno.remove(filename); - } + }, ); unitTest( @@ -62,7 +62,7 @@ unitTest( Deno.truncateSync(filename, -5); assertEquals(Deno.readFileSync(filename).byteLength, 0); Deno.removeSync(filename); - } + }, ); unitTest( @@ -77,7 +77,7 @@ unitTest( await Deno.truncate(filename, -5); assertEquals((await Deno.readFile(filename)).byteLength, 0); await Deno.remove(filename); - } + }, ); unitTest({ perms: { write: false } }, function truncateSyncPerm(): void { diff --git a/cli/tests/unit/umask_test.ts b/cli/tests/unit/umask_test.ts index bfac65d52..6fe51254d 100644 --- a/cli/tests/unit/umask_test.ts +++ b/cli/tests/unit/umask_test.ts @@ -11,5 +11,5 @@ unitTest( const finalMask = Deno.umask(); assertEquals(newMask, 0o020); assertEquals(finalMask, prevMask); - } + }, ); diff --git a/cli/tests/unit/unit_test_runner.ts b/cli/tests/unit/unit_test_runner.ts index b2e872200..815a501f2 100755 --- a/cli/tests/unit/unit_test_runner.ts +++ b/cli/tests/unit/unit_test_runner.ts @@ -42,7 +42,7 @@ const PERMISSIONS: Deno.PermissionName[] = [ * Take a list of permissions and revoke missing permissions. */ async function dropWorkerPermissions( - requiredPermissions: Deno.PermissionName[] + requiredPermissions: Deno.PermissionName[], ): Promise<void> { const permsToDrop = PERMISSIONS.filter((p): boolean => { return !requiredPermissions.includes(p); @@ -56,7 +56,7 @@ async function dropWorkerPermissions( async function workerRunnerMain( addrStr: string, permsStr: string, - filter?: string + filter?: string, ): Promise<void> { const [hostname, port] = addrStr.split(":"); const addr = { hostname, port: Number(port) }; @@ -84,7 +84,7 @@ function spawnWorkerRunner( verbose: boolean, addr: string, perms: Permissions, - filter?: string + filter?: string, ): Deno.Process { // run subsequent tests using same deno executable const permStr = Object.keys(perms) @@ -126,7 +126,7 @@ async function runTestsForPermissionSet( addrStr: string, verbose: boolean, perms: Permissions, - filter?: string + filter?: string, ): Promise<PermissionSetTestResult> { const permsFmt = fmtPerms(perms); console.log(`Running tests for: ${permsFmt}`); @@ -165,7 +165,7 @@ async function runTestsForPermissionSet( const workerStatus = await workerProcess.status(); if (!workerStatus.success) { throw new Error( - `Worker runner exited with status code: ${workerStatus.code}` + `Worker runner exited with status code: ${workerStatus.code}`, ); } @@ -183,11 +183,11 @@ async function runTestsForPermissionSet( async function masterRunnerMain( verbose: boolean, - filter?: string + filter?: string, ): Promise<void> { console.log( "Discovered permission combinations for tests:", - permissionCombinations.size + permissionCombinations.size, ); for (const perms of permissionCombinations.values()) { @@ -205,7 +205,7 @@ async function masterRunnerMain( addrStr, verbose, perms, - filter + filter, ); testResults.add(result); } @@ -230,7 +230,7 @@ async function masterRunnerMain( if (REGISTERED_UNIT_TESTS.find(({ only }) => only)) { console.error( - `\n${colors.red("FAILED")} because the "only" option was used` + `\n${colors.red("FAILED")} because the "only" option was used`, ); Deno.exit(1); } diff --git a/cli/tests/unit/url_search_params_test.ts b/cli/tests/unit/url_search_params_test.ts index 227deeda7..6965fe128 100644 --- a/cli/tests/unit/url_search_params_test.ts +++ b/cli/tests/unit/url_search_params_test.ts @@ -6,7 +6,7 @@ unitTest(function urlSearchParamsInitString(): void { const searchParams = new URLSearchParams(init); assert( init === searchParams.toString(), - "The init query string does not match" + "The init query string does not match", ); }); @@ -243,7 +243,7 @@ unitTest( }; const params1 = new URLSearchParams((params as unknown) as string[][]); assertEquals(params1.get("1"), "2"); - } + }, ); // If a class extends URLSearchParams, override one method should not change another's behavior. @@ -261,7 +261,7 @@ unitTest( new CustomSearchParams(new CustomSearchParams({ foo: "bar" })); new CustomSearchParams().set("foo", "bar"); assertEquals(overridedAppendCalled, 0); - } + }, ); unitTest(function urlSearchParamsOverridingEntriesNotChangeForEach(): void { diff --git a/cli/tests/unit/url_test.ts b/cli/tests/unit/url_test.ts index 37d92089b..15833633a 100644 --- a/cli/tests/unit/url_test.ts +++ b/cli/tests/unit/url_test.ts @@ -3,14 +3,14 @@ import { unitTest, assert, assertEquals, assertThrows } from "./test_util.ts"; unitTest(function urlParsing(): void { const url = new URL( - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); assertEquals(url.hash, "#qat"); assertEquals(url.host, "baz.qat:8000"); assertEquals(url.hostname, "baz.qat"); assertEquals( url.href, - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); assertEquals(url.origin, "https://baz.qat:8000"); assertEquals(url.password, "bar"); @@ -23,7 +23,7 @@ unitTest(function urlParsing(): void { assertEquals(url.username, "foo"); assertEquals( String(url), - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); }); @@ -90,32 +90,32 @@ unitTest(function urlPortParsing(): void { unitTest(function urlModifications(): void { const url = new URL( - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); url.hash = ""; assertEquals( url.href, - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12", ); url.host = "qat.baz:8080"; assertEquals( url.href, - "https://foo:bar@qat.baz:8080/qux/quux?foo=bar&baz=12" + "https://foo:bar@qat.baz:8080/qux/quux?foo=bar&baz=12", ); url.hostname = "foo.bar"; assertEquals( url.href, - "https://foo:bar@foo.bar:8080/qux/quux?foo=bar&baz=12" + "https://foo:bar@foo.bar:8080/qux/quux?foo=bar&baz=12", ); url.password = "qux"; assertEquals( url.href, - "https://foo:qux@foo.bar:8080/qux/quux?foo=bar&baz=12" + "https://foo:qux@foo.bar:8080/qux/quux?foo=bar&baz=12", ); url.pathname = "/foo/bar%qat"; assertEquals( url.href, - "https://foo:qux@foo.bar:8080/foo/bar%qat?foo=bar&baz=12" + "https://foo:qux@foo.bar:8080/foo/bar%qat?foo=bar&baz=12", ); url.port = ""; assertEquals(url.href, "https://foo:qux@foo.bar/foo/bar%qat?foo=bar&baz=12"); @@ -127,19 +127,19 @@ unitTest(function urlModifications(): void { url.username = "foo@bar"; assertEquals( url.href, - "http://foo%40bar:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz" + "http://foo%40bar:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz", ); url.searchParams.set("bar", "qat"); assertEquals( url.href, - "http://foo%40bar:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz&bar=qat" + "http://foo%40bar:qux@foo.bar/foo/bar%qat?foo=bar&foo=baz&bar=qat", ); url.searchParams.delete("foo"); assertEquals(url.href, "http://foo%40bar:qux@foo.bar/foo/bar%qat?bar=qat"); url.searchParams.append("foo", "bar"); assertEquals( url.href, - "http://foo%40bar:qux@foo.bar/foo/bar%qat?bar=qat&foo=bar" + "http://foo%40bar:qux@foo.bar/foo/bar%qat?bar=qat&foo=bar", ); }); @@ -182,7 +182,7 @@ unitTest(function urlModifyHash(): void { unitTest(function urlSearchParamsReuse(): void { const url = new URL( - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); const sp = url.searchParams; url.host = "baz.qat"; @@ -191,11 +191,11 @@ unitTest(function urlSearchParamsReuse(): void { unitTest(function urlBackSlashes(): void { const url = new URL( - "https:\\\\foo:bar@baz.qat:8000\\qux\\quux?foo=bar&baz=12#qat" + "https:\\\\foo:bar@baz.qat:8000\\qux\\quux?foo=bar&baz=12#qat", ); assertEquals( url.href, - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); }); @@ -221,7 +221,7 @@ unitTest(function urlRequireHost(): void { unitTest(function urlDriveLetter() { assertEquals( new URL("file:///C:").href, - Deno.build.os == "windows" ? "file:///C:/" : "file:///C:" + Deno.build.os == "windows" ? "file:///C:/" : "file:///C:", ); assertEquals(new URL("http://example.com/C:").href, "http://example.com/C:"); }); @@ -229,15 +229,15 @@ unitTest(function urlDriveLetter() { unitTest(function urlUncHostname() { assertEquals( new URL("file:////").href, - Deno.build.os == "windows" ? "file:///" : "file:////" + Deno.build.os == "windows" ? "file:///" : "file:////", ); assertEquals( new URL("file:////server").href, - Deno.build.os == "windows" ? "file://server/" : "file:////server" + Deno.build.os == "windows" ? "file://server/" : "file:////server", ); assertEquals( new URL("file:////server/file").href, - Deno.build.os == "windows" ? "file://server/file" : "file:////server/file" + Deno.build.os == "windows" ? "file://server/file" : "file:////server/file", ); }); @@ -259,39 +259,39 @@ unitTest(function urlTrim() { unitTest(function urlEncoding() { assertEquals( new URL("https://a !$&*()=,;+'\"@example.com").username, - "a%20!$&*()%3D,%3B+%27%22" + "a%20!$&*()%3D,%3B+%27%22", ); assertEquals( new URL("https://:a !$&*()=,;+'\"@example.com").password, - "a%20!$&*()%3D,%3B+%27%22" + "a%20!$&*()%3D,%3B+%27%22", ); assertEquals(new URL("abcde://mañana/c?d#e").hostname, "ma%C3%B1ana"); // https://url.spec.whatwg.org/#idna assertEquals(new URL("https://mañana/c?d#e").hostname, "xn--maana-pta"); assertEquals( new URL("https://example.com/a ~!@$&*()=:/,;+'\"\\").pathname, - "/a%20~!@$&*()=:/,;+'%22/" + "/a%20~!@$&*()=:/,;+'%22/", ); assertEquals( new URL("https://example.com?a ~!@$&*()=:/,;?+'\"\\").search, - "?a%20~!@$&*()=:/,;?+%27%22\\" + "?a%20~!@$&*()=:/,;?+%27%22\\", ); assertEquals( new URL("https://example.com#a ~!@#$&*()=:/,;?+'\"\\").hash, - "#a%20~!@#$&*()=:/,;?+'%22\\" + "#a%20~!@#$&*()=:/,;?+'%22\\", ); }); unitTest(function urlBaseURL(): void { const base = new URL( - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); const url = new URL("/foo/bar?baz=foo#qux", base); assertEquals(url.href, "https://foo:bar@baz.qat:8000/foo/bar?baz=foo#qux"); assertEquals( new URL("D", "https://foo.bar/path/a/b/c/d").href, - "https://foo.bar/path/a/b/c/D" + "https://foo.bar/path/a/b/c/D", ); assertEquals(new URL("D", "https://foo.bar").href, "https://foo.bar/D"); @@ -299,14 +299,14 @@ unitTest(function urlBaseURL(): void { assertEquals( new URL("/d", "https://foo.bar/path/a/b/c/d").href, - "https://foo.bar/d" + "https://foo.bar/d", ); }); unitTest(function urlBaseString(): void { const url = new URL( "/foo/bar?baz=foo#qux", - "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat" + "https://foo:bar@baz.qat:8000/qux/quux?foo=bar&baz=12#qat", ); assertEquals(url.href, "https://foo:bar@baz.qat:8000/foo/bar?baz=foo#qux"); }); @@ -324,19 +324,19 @@ unitTest(function urlRelativeWithBase(): void { unitTest(function urlDriveLetterBase() { assertEquals( new URL("/b", "file:///C:/a/b").href, - Deno.build.os == "windows" ? "file:///C:/b" : "file:///b" + Deno.build.os == "windows" ? "file:///C:/b" : "file:///b", ); assertEquals( new URL("D:", "file:///C:/a/b").href, - Deno.build.os == "windows" ? "file:///D:/" : "file:///C:/a/D:" + Deno.build.os == "windows" ? "file:///D:/" : "file:///C:/a/D:", ); assertEquals( new URL("/D:", "file:///C:/a/b").href, - Deno.build.os == "windows" ? "file:///D:/" : "file:///D:" + Deno.build.os == "windows" ? "file:///D:/" : "file:///D:", ); assertEquals( new URL("D:/b", "file:///C:/a/b").href, - Deno.build.os == "windows" ? "file:///D:/b" : "file:///C:/a/D:/b" + Deno.build.os == "windows" ? "file:///D:/b" : "file:///C:/a/D:/b", ); }); @@ -377,9 +377,9 @@ unitTest( const url = new URL("http://example.com/?"); assertEquals( Deno.inspect(url), - 'URL { href: "http://example.com/?", origin: "http://example.com", protocol: "http:", username: "", password: "", host: "example.com", hostname: "example.com", port: "", pathname: "/", hash: "", search: "?" }' + 'URL { href: "http://example.com/?", origin: "http://example.com", protocol: "http:", username: "", password: "", host: "example.com", hostname: "example.com", port: "", pathname: "/", hash: "", search: "?" }', ); - } + }, ); unitTest(function protocolNotHttpOrFile() { @@ -418,7 +418,7 @@ unitTest(function throwForInvalidSchemeConstructor(): void { assertThrows( () => new URL("invalid_scheme://baz.qat"), TypeError, - "Invalid URL." + "Invalid URL.", ); }); diff --git a/cli/tests/unit/utime_test.ts b/cli/tests/unit/utime_test.ts index 7f54349e0..cc68e90cd 100644 --- a/cli/tests/unit/utime_test.ts +++ b/cli/tests/unit/utime_test.ts @@ -29,7 +29,7 @@ unitTest( const fileInfo = Deno.statSync(filename); assertFuzzyTimestampEquals(fileInfo.atime, new Date(atime * 1000)); assertFuzzyTimestampEquals(fileInfo.mtime, new Date(mtime * 1000)); - } + }, ); unitTest( @@ -44,7 +44,7 @@ unitTest( const dirInfo = Deno.statSync(testDir); assertFuzzyTimestampEquals(dirInfo.atime, new Date(atime * 1000)); assertFuzzyTimestampEquals(dirInfo.mtime, new Date(mtime * 1000)); - } + }, ); unitTest( @@ -59,7 +59,7 @@ unitTest( const dirInfo = Deno.statSync(testDir); assertFuzzyTimestampEquals(dirInfo.atime, atime); assertFuzzyTimestampEquals(dirInfo.mtime, mtime); - } + }, ); unitTest( @@ -77,7 +77,7 @@ unitTest( const fileInfo = Deno.statSync(filename); assertFuzzyTimestampEquals(fileInfo.atime, atime); assertFuzzyTimestampEquals(fileInfo.mtime, mtime); - } + }, ); unitTest( @@ -94,7 +94,7 @@ unitTest( const dirInfo = Deno.statSync(testDir); assertFuzzyTimestampEquals(dirInfo.atime, new Date(atime * 1000)); assertFuzzyTimestampEquals(dirInfo.mtime, new Date(mtime * 1000)); - } + }, ); unitTest( @@ -106,7 +106,7 @@ unitTest( assertThrows(() => { Deno.utimeSync("/baddir", atime, mtime); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -118,7 +118,7 @@ unitTest( assertThrows(() => { Deno.utimeSync("/some_dir", atime, mtime); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -137,7 +137,7 @@ unitTest( const fileInfo = Deno.statSync(filename); assertFuzzyTimestampEquals(fileInfo.atime, new Date(atime * 1000)); assertFuzzyTimestampEquals(fileInfo.mtime, new Date(mtime * 1000)); - } + }, ); unitTest( @@ -152,7 +152,7 @@ unitTest( const dirInfo = Deno.statSync(testDir); assertFuzzyTimestampEquals(dirInfo.atime, new Date(atime * 1000)); assertFuzzyTimestampEquals(dirInfo.mtime, new Date(mtime * 1000)); - } + }, ); unitTest( @@ -167,7 +167,7 @@ unitTest( const dirInfo = Deno.statSync(testDir); assertFuzzyTimestampEquals(dirInfo.atime, atime); assertFuzzyTimestampEquals(dirInfo.mtime, mtime); - } + }, ); unitTest( @@ -186,7 +186,7 @@ unitTest( const fileInfo = Deno.statSync(filename); assertFuzzyTimestampEquals(fileInfo.atime, atime); assertFuzzyTimestampEquals(fileInfo.mtime, mtime); - } + }, ); unitTest( @@ -198,7 +198,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.utime("/baddir", atime, mtime); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -210,5 +210,5 @@ unitTest( await assertThrowsAsync(async () => { await Deno.utime("/some_dir", atime, mtime); }, Deno.errors.PermissionDenied); - } + }, ); diff --git a/cli/tests/unit/write_file_test.ts b/cli/tests/unit/write_file_test.ts index bbe1daf38..a48333b9d 100644 --- a/cli/tests/unit/write_file_test.ts +++ b/cli/tests/unit/write_file_test.ts @@ -17,7 +17,7 @@ unitTest( const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); assertEquals("Hello", actual); - } + }, ); unitTest( @@ -27,7 +27,7 @@ unitTest( const data = enc.encode("Hello"); const tempDir = Deno.makeTempDirSync(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt`, ); Deno.writeFileSync(fileUrl, data); const dataRead = Deno.readFileSync(fileUrl); @@ -36,7 +36,7 @@ unitTest( assertEquals("Hello", actual); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest({ perms: { write: true } }, function writeFileSyncFail(): void { @@ -71,7 +71,7 @@ unitTest( Deno.writeFileSync(filename, data, { mode: 0o666 }); assertEquals(Deno.statSync(filename).mode! & 0o777, 0o666); } - } + }, ); unitTest( @@ -92,7 +92,7 @@ unitTest( const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); assertEquals("Hello", actual); - } + }, ); unitTest( @@ -117,7 +117,7 @@ unitTest( dataRead = Deno.readFileSync(filename); actual = dec.decode(dataRead); assertEquals("Hello", actual); - } + }, ); unitTest( @@ -131,7 +131,7 @@ unitTest( const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); assertEquals("Hello", actual); - } + }, ); unitTest( @@ -141,7 +141,7 @@ unitTest( const data = enc.encode("Hello"); const tempDir = await Deno.makeTempDir(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt`, ); await Deno.writeFile(fileUrl, data); const dataRead = Deno.readFileSync(fileUrl); @@ -150,7 +150,7 @@ unitTest( assertEquals("Hello", actual); Deno.removeSync(tempDir, { recursive: true }); - } + }, ); unitTest( @@ -163,7 +163,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.writeFile(filename, data); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -176,7 +176,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.writeFile(filename, data); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -191,7 +191,7 @@ unitTest( await Deno.writeFile(filename, data, { mode: 0o666 }); assertEquals(Deno.statSync(filename).mode! & 0o777, 0o666); } - } + }, ); unitTest( @@ -212,7 +212,7 @@ unitTest( const dec = new TextDecoder("utf-8"); const actual = dec.decode(dataRead); assertEquals("Hello", actual); - } + }, ); unitTest( @@ -237,5 +237,5 @@ unitTest( dataRead = Deno.readFileSync(filename); actual = dec.decode(dataRead); assertEquals("Hello", actual); - } + }, ); diff --git a/cli/tests/unit/write_text_file_test.ts b/cli/tests/unit/write_text_file_test.ts index 57e78b860..42c72de7a 100644 --- a/cli/tests/unit/write_text_file_test.ts +++ b/cli/tests/unit/write_text_file_test.ts @@ -13,7 +13,7 @@ unitTest( Deno.writeTextFileSync(filename, "Hello"); const dataRead = Deno.readTextFileSync(filename); assertEquals("Hello", dataRead); - } + }, ); unitTest( @@ -21,14 +21,14 @@ unitTest( function writeTextFileSyncByUrl(): void { const tempDir = Deno.makeTempDirSync(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt`, ); Deno.writeTextFileSync(fileUrl, "Hello"); const dataRead = Deno.readTextFileSync(fileUrl); assertEquals("Hello", dataRead); Deno.removeSync(fileUrl, { recursive: true }); - } + }, ); unitTest({ perms: { write: true } }, function writeTextFileSyncFail(): void { @@ -58,7 +58,7 @@ unitTest( Deno.writeTextFileSync(filename, data, { mode: 0o666 }); assertEquals(Deno.statSync(filename).mode! & 0o777, 0o666); } - } + }, ); unitTest( @@ -80,7 +80,7 @@ unitTest( Deno.writeTextFileSync(filename, data, { create: true }); Deno.writeTextFileSync(filename, data, { create: false }); assertEquals("Hello", Deno.readTextFileSync(filename)); - } + }, ); unitTest( @@ -97,7 +97,7 @@ unitTest( // append not set should also overwrite Deno.writeTextFileSync(filename, data); assertEquals("Hello", Deno.readTextFileSync(filename)); - } + }, ); unitTest( @@ -107,7 +107,7 @@ unitTest( await Deno.writeTextFile(filename, "Hello"); const dataRead = Deno.readTextFileSync(filename); assertEquals("Hello", dataRead); - } + }, ); unitTest( @@ -115,14 +115,14 @@ unitTest( async function writeTextFileByUrl(): Promise<void> { const tempDir = Deno.makeTempDirSync(); const fileUrl = new URL( - `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt` + `file://${Deno.build.os === "windows" ? "/" : ""}${tempDir}/test.txt`, ); await Deno.writeTextFile(fileUrl, "Hello"); const dataRead = Deno.readTextFileSync(fileUrl); assertEquals("Hello", dataRead); Deno.removeSync(fileUrl, { recursive: true }); - } + }, ); unitTest( @@ -133,7 +133,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.writeTextFile(filename, "Hello"); }, Deno.errors.NotFound); - } + }, ); unitTest( @@ -144,7 +144,7 @@ unitTest( await assertThrowsAsync(async () => { await Deno.writeTextFile(filename, "Hello"); }, Deno.errors.PermissionDenied); - } + }, ); unitTest( @@ -158,7 +158,7 @@ unitTest( await Deno.writeTextFile(filename, data, { mode: 0o666 }); assertEquals(Deno.statSync(filename).mode! & 0o777, 0o666); } - } + }, ); unitTest( @@ -180,7 +180,7 @@ unitTest( await Deno.writeTextFile(filename, data, { create: true }); await Deno.writeTextFile(filename, data, { create: false }); assertEquals("Hello", Deno.readTextFileSync(filename)); - } + }, ); unitTest( @@ -197,5 +197,5 @@ unitTest( // append not set should also overwrite await Deno.writeTextFile(filename, data); assertEquals("Hello", Deno.readTextFileSync(filename)); - } + }, ); diff --git a/cli/tests/wasm.ts b/cli/tests/wasm.ts index 26ad7ba28..98da19d26 100644 --- a/cli/tests/wasm.ts +++ b/cli/tests/wasm.ts @@ -1,4 +1,4 @@ -// prettier-ignore +// deno-fmt-ignore const wasmCode = new Uint8Array([ 0, 97, 115, 109, 1, 0, 0, 0, 1, 133, 128, 128, 128, 0, 1, 96, 0, 1, 127, 3, 130, 128, 128, 128, 0, 1, 0, 4, 132, 128, 128, 128, 0, 1, 112, 0, 0, diff --git a/cli/tests/wasm_async.js b/cli/tests/wasm_async.js index 98a178aad..837460ae9 100644 --- a/cli/tests/wasm_async.js +++ b/cli/tests/wasm_async.js @@ -7,7 +7,7 @@ // i32.add) // (export "add" (func $add)) // ) -// prettier-ignore +// deno-fmt-ignore const bytes = new Uint8Array([ 0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x07, 0x01, 0x60, 0x02, 0x7f, 0x7f, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x07, 0x07, 0x01, diff --git a/cli/tests/workers_round_robin_bench.ts b/cli/tests/workers_round_robin_bench.ts index d7224b41d..90ebb0364 100644 --- a/cli/tests/workers_round_robin_bench.ts +++ b/cli/tests/workers_round_robin_bench.ts @@ -25,7 +25,7 @@ export function createResolvable<T>(): Resolvable<T> { function handleAsyncMsgFromWorker( promiseTable: Map<number, Resolvable<string>>, - msg: { cmdId: number; data: string } + msg: { cmdId: number; data: string }, ): void { const promise = promiseTable.get(msg.cmdId); if (promise === null) { @@ -39,7 +39,7 @@ async function main(): Promise<void> { for (let i = 1; i <= workerCount; ++i) { const worker = new Worker( new URL("subdir/bench_worker.ts", import.meta.url).href, - { type: "module" } + { type: "module" }, ); const promise = createResolvable<void>(); worker.onmessage = (e): void => { diff --git a/cli/tests/workers_startup_bench.ts b/cli/tests/workers_startup_bench.ts index a25dc8ff7..5213e24cd 100644 --- a/cli/tests/workers_startup_bench.ts +++ b/cli/tests/workers_startup_bench.ts @@ -6,7 +6,7 @@ async function bench(): Promise<void> { for (let i = 1; i <= workerCount; ++i) { const worker = new Worker( new URL("subdir/bench_worker.ts", import.meta.url).href, - { type: "module" } + { type: "module" }, ); const promise = new Promise((resolve): void => { worker.onmessage = (e): void => { diff --git a/cli/tests/workers_test.ts b/cli/tests/workers_test.ts index feab0f9c2..395b1da24 100644 --- a/cli/tests/workers_test.ts +++ b/cli/tests/workers_test.ts @@ -34,11 +34,11 @@ Deno.test({ const jsWorker = new Worker( new URL("subdir/test_worker.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); const tsWorker = new Worker( new URL("subdir/test_worker.ts", import.meta.url).href, - { type: "module", name: "tsWorker" } + { type: "module", name: "tsWorker" }, ); tsWorker.onmessage = (e): void => { @@ -70,7 +70,7 @@ Deno.test({ const nestedWorker = new Worker( new URL("subdir/nested_worker.js", import.meta.url).href, - { type: "module", name: "nested" } + { type: "module", name: "nested" }, ); nestedWorker.onmessage = (e): void => { @@ -90,7 +90,7 @@ Deno.test({ const promise = createResolvable(); const throwingWorker = new Worker( new URL("subdir/throwing_worker.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -112,7 +112,7 @@ Deno.test({ const fetchingWorker = new Worker( new URL("subdir/fetching_worker.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); // eslint-disable-next-line @typescript-eslint/no-explicit-any @@ -139,7 +139,7 @@ Deno.test({ const busyWorker = new Worker( new URL("subdir/busy_worker.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); let testResult = 0; @@ -172,7 +172,7 @@ Deno.test({ const racyWorker = new Worker( new URL("subdir/racy_worker.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); racyWorker.onmessage = (e): void => { @@ -200,7 +200,7 @@ Deno.test({ const worker = new Worker( new URL("subdir/event_worker.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); worker.onmessage = (_e: Event): void => { @@ -244,7 +244,7 @@ Deno.test({ const worker = new Worker( new URL("subdir/event_worker_scope.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); worker.onmessage = (e: MessageEvent): void => { @@ -273,11 +273,11 @@ Deno.test({ const regularWorker = new Worker( new URL("subdir/non_deno_worker.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); const denoWorker = new Worker( new URL("subdir/deno_worker.ts", import.meta.url).href, - { type: "module", deno: true } + { type: "module", deno: true }, ); regularWorker.onmessage = (e): void => { @@ -305,7 +305,7 @@ Deno.test({ const promise = createResolvable(); const w = new Worker( new URL("subdir/worker_crypto.js", import.meta.url).href, - { type: "module" } + { type: "module" }, ); w.onmessage = (e): void => { assertEquals(e.data, true); |