summaryrefslogtreecommitdiff
path: root/cli/tests/unit/globals_test.ts
diff options
context:
space:
mode:
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);
});