summaryrefslogtreecommitdiff
path: root/cli/tests/unit/globals_test.ts
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2020-06-02 14:24:44 +1000
committerGitHub <noreply@github.com>2020-06-02 00:24:44 -0400
commit3fe6bc1b82a10bed1d907b749b1cc200659df612 (patch)
tree02e14128039d015a7256494a50476f61785e6f33 /cli/tests/unit/globals_test.ts
parent8b1b4766a1e747437a2b88fcadc26162a1bec640 (diff)
fix: Better use of @ts-expect-error (#6038)
Diffstat (limited to 'cli/tests/unit/globals_test.ts')
-rw-r--r--cli/tests/unit/globals_test.ts25
1 files changed, 14 insertions, 11 deletions
diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts
index bb5e5c604..ccea6e74c 100644
--- a/cli/tests/unit/globals_test.ts
+++ b/cli/tests/unit/globals_test.ts
@@ -45,16 +45,24 @@ unitTest(function webAssemblyExists(): void {
assert(typeof WebAssembly.compile === "function");
});
+/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any,no-var */
+declare global {
+ namespace Deno {
+ var core: any;
+ }
+}
+/* eslint-enable */
+
unitTest(function DenoNamespaceImmutable(): void {
const denoCopy = window.Deno;
try {
- // @ts-expect-error
- Deno = 1;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ (Deno as any) = 1;
} catch {}
assert(denoCopy === Deno);
try {
- // @ts-expect-error
- window.Deno = 1;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ (window as any).Deno = 1;
} catch {}
assert(denoCopy === Deno);
try {
@@ -64,8 +72,8 @@ unitTest(function DenoNamespaceImmutable(): void {
const { readFile } = Deno;
try {
- // @ts-expect-error
- Deno.readFile = 1;
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ (Deno as any).readFile = 1;
} catch {}
assert(readFile === Deno.readFile);
try {
@@ -73,19 +81,14 @@ unitTest(function DenoNamespaceImmutable(): void {
} catch {}
assert(readFile === Deno.readFile);
- // @ts-expect-error
const { print } = Deno.core;
try {
- // @ts-expect-error
Deno.core.print = 1;
} catch {}
- // @ts-expect-error
assert(print === Deno.core.print);
try {
- // @ts-expect-error
delete Deno.core.print;
} catch {}
- // @ts-expect-error
assert(print === Deno.core.print);
});