summaryrefslogtreecommitdiff
path: root/tests/node_compat/polyfill_globals.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/node_compat/polyfill_globals.js')
-rw-r--r--tests/node_compat/polyfill_globals.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/node_compat/polyfill_globals.js b/tests/node_compat/polyfill_globals.js
new file mode 100644
index 000000000..93246d2ef
--- /dev/null
+++ b/tests/node_compat/polyfill_globals.js
@@ -0,0 +1,25 @@
+// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
+import process from "node:process";
+import { Buffer } from "node:buffer";
+import {
+ clearImmediate,
+ clearInterval,
+ clearTimeout,
+ setImmediate,
+ setInterval,
+ setTimeout,
+} from "node:timers";
+import { performance } from "node:perf_hooks";
+import console from "node:console";
+globalThis.Buffer = Buffer;
+globalThis.clearImmediate = clearImmediate;
+globalThis.clearInterval = clearInterval;
+globalThis.clearTimeout = clearTimeout;
+globalThis.console = console;
+globalThis.global = globalThis;
+globalThis.performance = performance;
+globalThis.process = process;
+globalThis.setImmediate = setImmediate;
+globalThis.setInterval = setInterval;
+globalThis.setTimeout = setTimeout;
+delete globalThis.window;