mirror of
https://github.com/denoland/deno.git
synced 2025-08-03 10:33:54 +00:00
build: lint cli/tests/unit using deno lint (#6327)
This commit is contained in:
parent
36ad5e4402
commit
ffedbd79ad
8 changed files with 42 additions and 19 deletions
|
@ -47,7 +47,9 @@ unitTest(function webAssemblyExists(): void {
|
|||
|
||||
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-explicit-any,no-var */
|
||||
declare global {
|
||||
// deno-lint-ignore no-namespace
|
||||
namespace Deno {
|
||||
// deno-lint-ignore no-explicit-any
|
||||
var core: any;
|
||||
}
|
||||
}
|
||||
|
@ -58,37 +60,51 @@ unitTest(function DenoNamespaceImmutable(): void {
|
|||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(Deno as any) = 1;
|
||||
} catch {}
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(denoCopy === Deno);
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(window as any).Deno = 1;
|
||||
} catch {}
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(denoCopy === Deno);
|
||||
try {
|
||||
delete window.Deno;
|
||||
} catch {}
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(denoCopy === Deno);
|
||||
|
||||
const { readFile } = Deno;
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(Deno as any).readFile = 1;
|
||||
} catch {}
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(readFile === Deno.readFile);
|
||||
try {
|
||||
delete window.Deno.readFile;
|
||||
} catch {}
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(readFile === Deno.readFile);
|
||||
|
||||
const { print } = Deno.core;
|
||||
try {
|
||||
Deno.core.print = 1;
|
||||
} catch {}
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(print === Deno.core.print);
|
||||
try {
|
||||
delete Deno.core.print;
|
||||
} catch {}
|
||||
} catch {
|
||||
// pass
|
||||
}
|
||||
assert(print === Deno.core.print);
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue