diff options
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/042_dyn_import_evalcontext.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/body_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/console_test.ts | 5 | ||||
-rw-r--r-- | cli/tests/unit/dispatch_json_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/dispatch_minimal_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/dom_iterable_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/error_stack_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/event_target_test.ts | 6 | ||||
-rw-r--r-- | cli/tests/unit/fetch_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/files_test.ts | 4 | ||||
-rw-r--r-- | cli/tests/unit/form_data_test.ts | 14 | ||||
-rw-r--r-- | cli/tests/unit/globals_test.ts | 16 | ||||
-rw-r--r-- | cli/tests/unit/headers_test.ts | 12 | ||||
-rw-r--r-- | cli/tests/unit/internals_test.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/request_test.ts | 8 | ||||
-rw-r--r-- | cli/tests/unit/streams_internal_test.ts | 12 | ||||
-rwxr-xr-x | cli/tests/unit/unit_test_runner.ts | 2 | ||||
-rw-r--r-- | cli/tests/unit/url_search_params_test.ts | 6 |
18 files changed, 51 insertions, 58 deletions
diff --git a/cli/tests/042_dyn_import_evalcontext.ts b/cli/tests/042_dyn_import_evalcontext.ts index 124a406d2..e1cc485d1 100644 --- a/cli/tests/042_dyn_import_evalcontext.ts +++ b/cli/tests/042_dyn_import_evalcontext.ts @@ -1,4 +1,4 @@ -// @ts-ignore +// @ts-expect-error Deno.core.evalContext( "(async () => console.log(await import('./subdir/mod4.js')))()" ); diff --git a/cli/tests/unit/body_test.ts b/cli/tests/unit/body_test.ts index c8f783e04..fd91b5ced 100644 --- a/cli/tests/unit/body_test.ts +++ b/cli/tests/unit/body_test.ts @@ -42,7 +42,7 @@ unitTest( const body = buildBody(text); - // @ts-ignore + // @ts-expect-error body.contentType = "multipart/form-data;boundary=boundary"; const formData = await body.formData(); @@ -62,7 +62,7 @@ unitTest( const body = buildBody(text); - // @ts-ignore + // @ts-expect-error body.contentType = "application/x-www-form-urlencoded"; const formData = await body.formData(); diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts index 02d71e4ca..35985dc1c 100644 --- a/cli/tests/unit/console_test.ts +++ b/cli/tests/unit/console_test.ts @@ -22,7 +22,7 @@ const customInspect = Deno.customInspect; const { Console, stringifyArgs, - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol } = Deno[Deno.internal]; function stringify(...args: unknown[]): string { @@ -590,7 +590,7 @@ unitTest(function consoleTestStringifyIterable() { 0, <120 empty items> ]` ); -*/ + */ }); unitTest(async function consoleTestStringifyPromises(): Promise<void> { @@ -727,7 +727,6 @@ unitTest(function consoleTestCallToStringOnLabel(): void { mockConsole((console) => { for (const method of methods) { let hasCalled = false; - // @ts-ignore console[method]({ toString(): void { hasCalled = true; diff --git a/cli/tests/unit/dispatch_json_test.ts b/cli/tests/unit/dispatch_json_test.ts index 4e95b86a2..51c33befd 100644 --- a/cli/tests/unit/dispatch_json_test.ts +++ b/cli/tests/unit/dispatch_json_test.ts @@ -20,9 +20,9 @@ unitTest( ); unitTest(function malformedJsonControlBuffer(): void { - // @ts-ignore + // @ts-expect-error const opId = Deno.core.ops()["op_open"]; - // @ts-ignore + // @ts-expect-error const res = Deno.core.send(opId, new Uint8Array([1, 2, 3, 4, 5])); const resText = new TextDecoder().decode(res); // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/cli/tests/unit/dispatch_minimal_test.ts b/cli/tests/unit/dispatch_minimal_test.ts index afc17f4fb..1c7ba11f0 100644 --- a/cli/tests/unit/dispatch_minimal_test.ts +++ b/cli/tests/unit/dispatch_minimal_test.ts @@ -26,9 +26,9 @@ unitTest(async function sendAsyncStackTrace(): Promise<void> { }); unitTest(function malformedMinimalControlBuffer(): void { - // @ts-ignore + // @ts-expect-error const readOpId = Deno.core.ops()["op_read"]; - // @ts-ignore + // @ts-expect-error const res = Deno.core.send(readOpId, new Uint8Array([1, 2, 3, 4, 5])); const header = res.slice(0, 12); const buf32 = new Int32Array( diff --git a/cli/tests/unit/dom_iterable_test.ts b/cli/tests/unit/dom_iterable_test.ts index b9435b3bc..c4e535a25 100644 --- a/cli/tests/unit/dom_iterable_test.ts +++ b/cli/tests/unit/dom_iterable_test.ts @@ -20,7 +20,7 @@ function setup() { Base, // This is using an internal API we don't want published as types, so having // to cast to any to "trick" TypeScript - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol DomIterable: Deno[Deno.internal].DomIterableMixin(Base, dataSymbol), }; } diff --git a/cli/tests/unit/error_stack_test.ts b/cli/tests/unit/error_stack_test.ts index e5cedfcf5..eb0a5c0e6 100644 --- a/cli/tests/unit/error_stack_test.ts +++ b/cli/tests/unit/error_stack_test.ts @@ -1,7 +1,7 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. import { unitTest, assert } from "./test_util.ts"; -// @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol +// @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol const { setPrepareStackTrace } = Deno[Deno.internal]; interface CallSite { diff --git a/cli/tests/unit/event_target_test.ts b/cli/tests/unit/event_target_test.ts index 0c4eb4d0d..cfbe5285b 100644 --- a/cli/tests/unit/event_target_test.ts +++ b/cli/tests/unit/event_target_test.ts @@ -4,11 +4,8 @@ import { unitTest, assertEquals } from "./test_util.ts"; unitTest(function addEventListenerTest(): void { const document = new EventTarget(); - // @ts-ignore tests ignoring the type system for resilience assertEquals(document.addEventListener("x", null, false), undefined); - // @ts-ignore assertEquals(document.addEventListener("x", null, true), undefined); - // @ts-ignore assertEquals(document.addEventListener("x", null), undefined); }); @@ -71,11 +68,8 @@ unitTest(function anEventTargetCanBeSubclassed(): void { unitTest(function removingNullEventListenerShouldSucceed(): void { const document = new EventTarget(); - // @ts-ignore assertEquals(document.removeEventListener("x", null, false), undefined); - // @ts-ignore assertEquals(document.removeEventListener("x", null, true), undefined); - // @ts-ignore assertEquals(document.removeEventListener("x", null), undefined); }); diff --git a/cli/tests/unit/fetch_test.ts b/cli/tests/unit/fetch_test.ts index ed17c869a..97b001b55 100644 --- a/cli/tests/unit/fetch_test.ts +++ b/cli/tests/unit/fetch_test.ts @@ -93,7 +93,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyUsed(): Promise< assertEquals(response.bodyUsed, false); assertThrows((): void => { // Assigning to read-only property throws in the strict mode. - // @ts-ignore + // @ts-expect-error response.bodyUsed = true; }); await response.blob(); @@ -595,7 +595,7 @@ unitTest({ perms: { net: true } }, async function fetchBodyReadTwice(): Promise< const methods = ["json", "text", "formData", "arrayBuffer"]; for (const method of methods) { try { - // @ts-ignore + // @ts-expect-error await response[method](); fail( "Reading body multiple times should failed, the stream should've been locked." diff --git a/cli/tests/unit/files_test.ts b/cli/tests/unit/files_test.ts index a035c7074..9ab74be89 100644 --- a/cli/tests/unit/files_test.ts +++ b/cli/tests/unit/files_test.ts @@ -290,7 +290,7 @@ unitTest( // writing null should throw an error let err; try { - // @ts-ignore + // @ts-expect-error await file.write(null); } catch (e) { err = e; @@ -322,7 +322,7 @@ unitTest( // reading file into null buffer should throw an error let err; try { - // @ts-ignore + // @ts-expect-error await file.read(null); } catch (e) { err = e; diff --git a/cli/tests/unit/form_data_test.ts b/cli/tests/unit/form_data_test.ts index 10cbd30a7..5344d8512 100644 --- a/cli/tests/unit/form_data_test.ts +++ b/cli/tests/unit/form_data_test.ts @@ -41,9 +41,9 @@ unitTest(function formDataParamsGetSuccess(): void { formData.append("a", "true"); formData.append("b", "false"); formData.append("a", "null"); - // @ts-ignore + // @ts-expect-error formData.append("d", undefined); - // @ts-ignore + // @ts-expect-error formData.append("e", null); assertEquals(formData.get("a"), "true"); assertEquals(formData.get("b"), "false"); @@ -70,10 +70,10 @@ unitTest(function formDataParamsSetSuccess(): void { assertEquals(formData.getAll("b"), ["false"]); formData.set("a", "false"); assertEquals(formData.getAll("a"), ["false"]); - // @ts-ignore + // @ts-expect-error formData.set("d", undefined); assertEquals(formData.get("d"), "undefined"); - // @ts-ignore + // @ts-expect-error formData.set("e", null); assertEquals(formData.get("e"), "null"); }); @@ -134,7 +134,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { let hasThrown = 0; let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error formData[method](); hasThrown = 1; } catch (err) { @@ -158,7 +158,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error formData[method](); hasThrown = 1; } catch (err) { @@ -178,7 +178,7 @@ unitTest(function formDataParamsArgumentsCheck(): void { hasThrown = 0; errMsg = ""; try { - // @ts-ignore + // @ts-expect-error formData[method]("foo"); hasThrown = 1; } catch (err) { diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts index aa8b4f46e..bb5e5c604 100644 --- a/cli/tests/unit/globals_test.ts +++ b/cli/tests/unit/globals_test.ts @@ -48,12 +48,12 @@ unitTest(function webAssemblyExists(): void { unitTest(function DenoNamespaceImmutable(): void { const denoCopy = window.Deno; try { - // @ts-ignore + // @ts-expect-error Deno = 1; } catch {} assert(denoCopy === Deno); try { - // @ts-ignore + // @ts-expect-error window.Deno = 1; } catch {} assert(denoCopy === Deno); @@ -64,7 +64,7 @@ unitTest(function DenoNamespaceImmutable(): void { const { readFile } = Deno; try { - // @ts-ignore + // @ts-expect-error Deno.readFile = 1; } catch {} assert(readFile === Deno.readFile); @@ -73,19 +73,19 @@ unitTest(function DenoNamespaceImmutable(): void { } catch {} assert(readFile === Deno.readFile); - // @ts-ignore + // @ts-expect-error const { print } = Deno.core; try { - // @ts-ignore + // @ts-expect-error Deno.core.print = 1; } catch {} - // @ts-ignore + // @ts-expect-error assert(print === Deno.core.print); try { - // @ts-ignore + // @ts-expect-error delete Deno.core.print; } catch {} - // @ts-ignore + // @ts-expect-error assert(print === Deno.core.print); }); diff --git a/cli/tests/unit/headers_test.ts b/cli/tests/unit/headers_test.ts index aaa829837..6dd60c8c5 100644 --- a/cli/tests/unit/headers_test.ts +++ b/cli/tests/unit/headers_test.ts @@ -7,7 +7,7 @@ import { } from "./test_util.ts"; const { stringifyArgs, - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol } = Deno[Deno.internal]; // Logic heavily copied from web-platform-tests, make @@ -18,7 +18,7 @@ unitTest(function newHeaderTest(): void { new Headers(undefined); new Headers({}); try { - // @ts-ignore + // @ts-expect-error new Headers(null); } catch (e) { assertEquals( @@ -32,7 +32,7 @@ const headerDict: Record<string, string> = { name1: "value1", name2: "value2", name3: "value3", - // @ts-ignore + // @ts-expect-error name4: undefined, "Content-Type": "value4", }; @@ -269,7 +269,7 @@ unitTest(function headerParamsArgumentsCheck(): void { let hasThrown = 0; let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error headers[method](); hasThrown = 1; } catch (err) { @@ -293,7 +293,7 @@ unitTest(function headerParamsArgumentsCheck(): void { let errMsg = ""; try { - // @ts-ignore + // @ts-expect-error headers[method](); hasThrown = 1; } catch (err) { @@ -313,7 +313,7 @@ unitTest(function headerParamsArgumentsCheck(): void { hasThrown = 0; errMsg = ""; try { - // @ts-ignore + // @ts-expect-error headers[method]("foo"); hasThrown = 1; } catch (err) { diff --git a/cli/tests/unit/internals_test.ts b/cli/tests/unit/internals_test.ts index abd4c94c3..3f4bdae79 100644 --- a/cli/tests/unit/internals_test.ts +++ b/cli/tests/unit/internals_test.ts @@ -4,7 +4,7 @@ import { unitTest, assert } from "./test_util.ts"; unitTest(function internalsExists(): void { const { stringifyArgs, - // @ts-ignore TypeScript (as of 3.7) does not support indexing namespaces by symbol + // @ts-expect-error TypeScript (as of 3.7) does not support indexing namespaces by symbol } = Deno[Deno.internal]; assert(!!stringifyArgs); }); diff --git a/cli/tests/unit/request_test.ts b/cli/tests/unit/request_test.ts index 8a276c5e7..be6e956b7 100644 --- a/cli/tests/unit/request_test.ts +++ b/cli/tests/unit/request_test.ts @@ -10,7 +10,7 @@ unitTest(function fromInit(): void { }, }); - // @ts-ignore + // @ts-expect-error assertEquals("ahoyhoy", req._bodySource); assertEquals(req.url, "https://example.com"); assertEquals(req.headers.get("test-header"), "value"); @@ -18,13 +18,13 @@ unitTest(function fromInit(): void { unitTest(function fromRequest(): void { const r = new Request("https://example.com"); - // @ts-ignore + // @ts-expect-error r._bodySource = "ahoyhoy"; r.headers.set("test-header", "value"); const req = new Request(r); - // @ts-ignore + // @ts-expect-error assertEquals(req._bodySource, r._bodySource); assertEquals(req.url, r.url); assertEquals(req.headers.get("test-header"), r.headers.get("test-header")); @@ -44,6 +44,6 @@ unitTest(async function cloneRequestBodyStream(): Promise<void> { assertEquals(b1, b2); - // @ts-ignore + // @ts-expect-error assert(r1._bodySource !== r2._bodySource); }); diff --git a/cli/tests/unit/streams_internal_test.ts b/cli/tests/unit/streams_internal_test.ts index f324da194..f49c9f494 100644 --- a/cli/tests/unit/streams_internal_test.ts +++ b/cli/tests/unit/streams_internal_test.ts @@ -8,7 +8,7 @@ unitTest(function streamReadableHwmError() { () => { new ReadableStream<number>( undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark } ); }, @@ -20,7 +20,7 @@ unitTest(function streamReadableHwmError() { assertThrows(() => { new ReadableStream<number>( undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark: Symbol("hwk") } ); }, TypeError); @@ -33,7 +33,7 @@ unitTest(function streamWriteableHwmError() { () => { new WritableStream( undefined, - // @ts-ignore + // @ts-expect-error new CountQueuingStrategy({ highWaterMark }) ); }, @@ -45,7 +45,7 @@ unitTest(function streamWriteableHwmError() { assertThrows(() => { new WritableStream( undefined, - // @ts-ignore + // @ts-expect-error new CountQueuingStrategy({ highWaterMark: Symbol("hwmk") }) ); }, TypeError); @@ -59,7 +59,7 @@ unitTest(function streamTransformHwmError() { new TransformStream( undefined, undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark } ); }, @@ -72,7 +72,7 @@ unitTest(function streamTransformHwmError() { new TransformStream( undefined, undefined, - // @ts-ignore + // @ts-expect-error { highWaterMark: Symbol("hwmk") } ); }, TypeError); diff --git a/cli/tests/unit/unit_test_runner.ts b/cli/tests/unit/unit_test_runner.ts index 715dda500..e3df358d7 100755 --- a/cli/tests/unit/unit_test_runner.ts +++ b/cli/tests/unit/unit_test_runner.ts @@ -11,7 +11,7 @@ import { reportToConn, } from "./test_util.ts"; -// @ts-ignore +// @ts-expect-error const internalObj = Deno[Deno.internal]; // eslint-disable-next-line @typescript-eslint/no-explicit-any const reportToConsole = internalObj.reportToConsole as (message: any) => void; diff --git a/cli/tests/unit/url_search_params_test.ts b/cli/tests/unit/url_search_params_test.ts index 7b7dbab76..ce55a7520 100644 --- a/cli/tests/unit/url_search_params_test.ts +++ b/cli/tests/unit/url_search_params_test.ts @@ -177,7 +177,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void { const searchParams = new URLSearchParams(); let hasThrown = 0; try { - // @ts-ignore + // @ts-expect-error searchParams[method](); hasThrown = 1; } catch (err) { @@ -194,7 +194,7 @@ unitTest(function urlSearchParamsAppendArgumentsCheck(): void { const searchParams = new URLSearchParams(); let hasThrown = 0; try { - // @ts-ignore + // @ts-expect-error searchParams[method]("foo"); hasThrown = 1; } catch (err) { @@ -235,7 +235,7 @@ unitTest(function urlSearchParamsCustomSymbolIterator(): void { unitTest( function urlSearchParamsCustomSymbolIteratorWithNonStringParams(): void { const params = {}; - // @ts-ignore + // @ts-expect-error params[Symbol.iterator] = function* (): IterableIterator<[number, number]> { yield [1, 2]; }; |