summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-08-25 09:43:54 +1000
committerGitHub <noreply@github.com>2020-08-24 19:43:54 -0400
commitc4d5b01acfe0cac31f94743a57e8e619178ba563 (patch)
tree1987fe2e23c4db59a44159f4c7d21ecc61be4ad3 /cli/tests
parent9b0f9c876529696c8008dda8b3606e34d3fe98dc (diff)
feat: update to TypeScript 4.0 (#6514)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/complex_permissions_test.ts3
-rw-r--r--cli/tests/error_014_catch_dynamic_import_error.js.out4
-rw-r--r--cli/tests/esm_imports_b.js1
-rw-r--r--cli/tests/hash.ts2
-rw-r--r--cli/tests/performance_stats.out2
-rw-r--r--cli/tests/permission_test.ts3
-rw-r--r--cli/tests/subdir/throws.js1
-rw-r--r--cli/tests/unit/blob_test.ts9
-rw-r--r--cli/tests/unit/error_stack_test.ts2
-rw-r--r--cli/tests/unit/globals_test.ts6
-rw-r--r--cli/tests/unit/timers_test.ts11
11 files changed, 28 insertions, 16 deletions
diff --git a/cli/tests/complex_permissions_test.ts b/cli/tests/complex_permissions_test.ts
index f4b8e6c73..d7737fa2d 100644
--- a/cli/tests/complex_permissions_test.ts
+++ b/cli/tests/complex_permissions_test.ts
@@ -1,6 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const name = Deno.args[0];
-const test: { [key: string]: Function } = {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
read(files: string[]): void {
files.forEach((file) => Deno.readFileSync(file));
},
diff --git a/cli/tests/error_014_catch_dynamic_import_error.js.out b/cli/tests/error_014_catch_dynamic_import_error.js.out
index 1a2ab2fd8..5249425b3 100644
--- a/cli/tests/error_014_catch_dynamic_import_error.js.out
+++ b/cli/tests/error_014_catch_dynamic_import_error.js.out
@@ -6,7 +6,7 @@ TypeError: relative import path "does not exist either" not prefixed with / or .
Caught error thrown by dynamically imported module.
Error: An error
- at file:///[WILDCARD]tests/subdir/throws.js:5:7
+ at file:///[WILDCARD]tests/subdir/throws.js:6:7
Caught error thrown indirectly by dynamically imported module.
Error: An error
- at file:///[WILDCARD]tests/subdir/throws.js:5:7
+ at file:///[WILDCARD]tests/subdir/throws.js:6:7
diff --git a/cli/tests/esm_imports_b.js b/cli/tests/esm_imports_b.js
index 321dfc05a..240a32382 100644
--- a/cli/tests/esm_imports_b.js
+++ b/cli/tests/esm_imports_b.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
export function retb() {
return "b";
}
diff --git a/cli/tests/hash.ts b/cli/tests/hash.ts
index 9c230dcfc..74438bd77 100644
--- a/cli/tests/hash.ts
+++ b/cli/tests/hash.ts
@@ -1,4 +1,4 @@
-/* eslint-disable @typescript-eslint/camelcase, @typescript-eslint/no-explicit-any */
+/* eslint-disable @typescript-eslint/no-explicit-any */
const { args } = Deno;
import { createHash, SupportedAlgorithm } from "../../std/hash/mod.ts";
diff --git a/cli/tests/performance_stats.out b/cli/tests/performance_stats.out
index c623d81da..dd1dbe32e 100644
--- a/cli/tests/performance_stats.out
+++ b/cli/tests/performance_stats.out
@@ -1,5 +1,5 @@
[WILDCARD]
-Files: 44
+Files: 45
Nodes: [WILDCARD]
Identifiers: [WILDCARD]
Symbols: [WILDCARD]
diff --git a/cli/tests/permission_test.ts b/cli/tests/permission_test.ts
index 399c757d3..5050efde8 100644
--- a/cli/tests/permission_test.ts
+++ b/cli/tests/permission_test.ts
@@ -1,6 +1,7 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
const name = Deno.args[0];
-const test: { [key: string]: Function } = {
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+const test: { [key: string]: (...args: any[]) => void | Promise<void> } = {
readRequired(): Promise<void> {
Deno.readFileSync("README.md");
return Promise.resolve();
diff --git a/cli/tests/subdir/throws.js b/cli/tests/subdir/throws.js
index b77e7104f..91ce4628e 100644
--- a/cli/tests/subdir/throws.js
+++ b/cli/tests/subdir/throws.js
@@ -1,3 +1,4 @@
+/* eslint-disable */
export function boo() {
console.log("Boo!");
}
diff --git a/cli/tests/unit/blob_test.ts b/cli/tests/unit/blob_test.ts
index 494c2ac75..7ef9b0125 100644
--- a/cli/tests/unit/blob_test.ts
+++ b/cli/tests/unit/blob_test.ts
@@ -46,11 +46,12 @@ unitTest(function blobShouldNotThrowError(): void {
let hasThrown = false;
try {
- const options1: object = {
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ const options1: any = {
ending: "utf8",
hasOwnProperty: "hasOwnProperty",
};
- const options2: object = Object.create(null);
+ const options2 = Object.create(null);
new Blob(["Hello World"], options1);
new Blob(["Hello World"], options2);
} catch {
@@ -61,9 +62,9 @@ unitTest(function blobShouldNotThrowError(): void {
});
unitTest(function nativeEndLine(): void {
- const options: object = {
+ const options = {
ending: "native",
- };
+ } as const;
const blob = new Blob(["Hello\nWorld"], options);
assertEquals(blob.size, Deno.build.os === "windows" ? 12 : 11);
diff --git a/cli/tests/unit/error_stack_test.ts b/cli/tests/unit/error_stack_test.ts
index cd21d471c..50cc2493b 100644
--- a/cli/tests/unit/error_stack_test.ts
+++ b/cli/tests/unit/error_stack_test.ts
@@ -7,6 +7,7 @@ const { setPrepareStackTrace } = Deno[Deno.internal];
interface CallSite {
getThis(): unknown;
getTypeName(): string | null;
+ // eslint-disable-next-line @typescript-eslint/ban-types
getFunction(): Function | null;
getFunctionName(): string | null;
getMethodName(): string | null;
@@ -35,6 +36,7 @@ function getMockCallSite(
getTypeName(): string {
return "";
},
+ // eslint-disable-next-line @typescript-eslint/ban-types
getFunction(): Function {
return (): void => {};
},
diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts
index 116df1698..dabe3c08e 100644
--- a/cli/tests/unit/globals_test.ts
+++ b/cli/tests/unit/globals_test.ts
@@ -72,7 +72,8 @@ unitTest(function DenoNamespaceImmutable(): void {
}
assert(denoCopy === Deno);
try {
- delete window.Deno;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ delete (window as any).Deno;
} catch {
// pass
}
@@ -87,7 +88,8 @@ unitTest(function DenoNamespaceImmutable(): void {
}
assert(readFile === Deno.readFile);
try {
- delete window.Deno.readFile;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ delete (window as any).Deno.readFile;
} catch {
// pass
}
diff --git a/cli/tests/unit/timers_test.ts b/cli/tests/unit/timers_test.ts
index b7f6dd520..30da0dfe9 100644
--- a/cli/tests/unit/timers_test.ts
+++ b/cli/tests/unit/timers_test.ts
@@ -7,16 +7,19 @@ import {
assertNotEquals,
} from "./test_util.ts";
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
+type AnyRecord = Record<any, any>;
+
function deferred(): {
- promise: Promise<{}>;
- resolve: (value?: {} | PromiseLike<{}>) => void;
+ promise: Promise<AnyRecord>;
+ resolve: (value?: AnyRecord | PromiseLike<AnyRecord>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
reject: (reason?: any) => void;
} {
- let resolve: (value?: {} | PromiseLike<{}>) => void;
+ let resolve: (value?: AnyRecord | PromiseLike<AnyRecord>) => void;
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let reject: ((reason?: any) => void) | undefined = undefined;
- const promise = new Promise<{}>((res, rej): void => {
+ const promise = new Promise<AnyRecord>((res, rej): void => {
resolve = res;
reject = rej;
});