diff options
author | Kamil Ogórek <kamil.ogorek@gmail.com> | 2023-02-09 01:11:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-08 19:11:12 -0500 |
commit | ef9b66950f4557003bc7d4246da838545466a518 (patch) | |
tree | 8ee23827a7659d98480a369b4e1d3bf990d63b01 /cli/tests/testdata/npm/compare_globals/main.ts | |
parent | 286e5d0be9bb11a69d55f0eedd4a6678b0d48e7d (diff) |
fix: use static Reflect methods in nodeGlobalThis proxy (#17696)
Co-authored-by: David Sherret <dsherret@gmail.com>
Diffstat (limited to 'cli/tests/testdata/npm/compare_globals/main.ts')
-rw-r--r-- | cli/tests/testdata/npm/compare_globals/main.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/tests/testdata/npm/compare_globals/main.ts b/cli/tests/testdata/npm/compare_globals/main.ts index 5710d0bd5..0468404a8 100644 --- a/cli/tests/testdata/npm/compare_globals/main.ts +++ b/cli/tests/testdata/npm/compare_globals/main.ts @@ -12,3 +12,16 @@ type _TestHasNodeJsGlobal = NodeJS.Architecture; const controller = new AbortController(); controller.abort("reason"); // in the NodeJS declaration it doesn't have a reason + +// Super edge case where some Node code deletes a global where the +// Node code has its own global and the Deno code has the same global, +// but it's different. Basically if some Node code deletes +// one of these globals then we don't want it to suddenly inherit +// the Deno global. +globals.withNodeGlobalThis((nodeGlobalThis: any) => { + (globalThis as any).setTimeout = 5; + console.log(setTimeout); + delete nodeGlobalThis["setTimeout"]; + console.log(nodeGlobalThis["setTimeout"]); // should be undefined + console.log(globalThis["setTimeout"]); // should be undefined +}); |