summaryrefslogtreecommitdiff
path: root/cli/tests/testdata/compat/globals.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2021-10-06 19:07:04 +0200
committerGitHub <noreply@github.com>2021-10-06 19:07:04 +0200
commitb686907a45bb7d113f863cca7c52754027e449c0 (patch)
tree9bc296cc2ade609c4276fce1f14128338c0e6f1f /cli/tests/testdata/compat/globals.ts
parentb033a7a6d4ac6f1d3e20b5d113cca2fd85cacfc3 (diff)
feat(compat): inject Node globals (#12342)
This commit adds automatic injection of Node globals when "--compat" flag is present. This is done by executing "https://deno.land/std/node/global.ts" as a "side module", before main module is executed. This commit makes "--compat" required to be used with "--unstable" flag, as some of Node globals require unstable Deno APIs.
Diffstat (limited to 'cli/tests/testdata/compat/globals.ts')
-rw-r--r--cli/tests/testdata/compat/globals.ts8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/tests/testdata/compat/globals.ts b/cli/tests/testdata/compat/globals.ts
new file mode 100644
index 000000000..39a555cbf
--- /dev/null
+++ b/cli/tests/testdata/compat/globals.ts
@@ -0,0 +1,8 @@
+if (global != window) {
+ throw new Error("global is not equal to window");
+}
+
+console.log(process);
+console.log(Buffer);
+console.log(setImmediate);
+console.log(clearImmediate);