summaryrefslogtreecommitdiff
path: root/tests/specs/run
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs/run')
-rw-r--r--tests/specs/run/node_globals_hints/buffer.out3
-rw-r--r--tests/specs/run/node_globals_hints/clear_immediate.out3
-rw-r--r--tests/specs/run/node_globals_hints/global.out3
-rw-r--r--tests/specs/run/node_globals_hints/set_immediate.out3
-rw-r--r--tests/specs/run/unstable/__test__.jsonc5
-rw-r--r--tests/specs/run/unstable/node_globals.out4
-rw-r--r--tests/specs/run/unstable/node_globals.ts7
7 files changed, 24 insertions, 4 deletions
diff --git a/tests/specs/run/node_globals_hints/buffer.out b/tests/specs/run/node_globals_hints/buffer.out
index 4980e6d12..858f404ab 100644
--- a/tests/specs/run/node_globals_hints/buffer.out
+++ b/tests/specs/run/node_globals_hints/buffer.out
@@ -4,4 +4,5 @@ Buffer;
at [WILDCARD]buffer.js:1:1
info: Buffer is not available in the global scope in Deno.
- hint: Import it explicitly with import { Buffer } from "node:buffer";.
+ hint: Import it explicitly with import { Buffer } from "node:buffer";,
+ or run again with --unstable-node-globals flag to add this global.
diff --git a/tests/specs/run/node_globals_hints/clear_immediate.out b/tests/specs/run/node_globals_hints/clear_immediate.out
index ecd34babe..a973a3172 100644
--- a/tests/specs/run/node_globals_hints/clear_immediate.out
+++ b/tests/specs/run/node_globals_hints/clear_immediate.out
@@ -4,4 +4,5 @@ clearImmediate;
at [WILDCARD]clear_immediate.js:1:1
info: clearImmediate is not available in the global scope in Deno.
- hint: Import it explicitly with import { clearImmediate } from "node:timers";.
+ hint: Import it explicitly with import { clearImmediate } from "node:timers";,
+ or run again with --unstable-node-globals flag to add this global.
diff --git a/tests/specs/run/node_globals_hints/global.out b/tests/specs/run/node_globals_hints/global.out
index e090d32e2..ad01ac426 100644
--- a/tests/specs/run/node_globals_hints/global.out
+++ b/tests/specs/run/node_globals_hints/global.out
@@ -4,4 +4,5 @@ global;
at [WILDCARD]global.js:1:1
info: global is not available in the global scope in Deno.
- hint: Use globalThis instead, or assign globalThis.global = globalThis.
+ hint: Use globalThis instead, or assign globalThis.global = globalThis,
+ or run again with --unstable-node-globals flag to add this global.
diff --git a/tests/specs/run/node_globals_hints/set_immediate.out b/tests/specs/run/node_globals_hints/set_immediate.out
index 38859ff5d..b3feb3127 100644
--- a/tests/specs/run/node_globals_hints/set_immediate.out
+++ b/tests/specs/run/node_globals_hints/set_immediate.out
@@ -4,4 +4,5 @@ setImmediate;
at [WILDCARD]set_immediate.js:1:1
info: setImmediate is not available in the global scope in Deno.
- hint: Import it explicitly with import { setImmediate } from "node:timers";.
+ hint: Import it explicitly with import { setImmediate } from "node:timers";,
+ or run again with --unstable-node-globals flag to add this global.
diff --git a/tests/specs/run/unstable/__test__.jsonc b/tests/specs/run/unstable/__test__.jsonc
index 3ddcdb583..bceb2ac12 100644
--- a/tests/specs/run/unstable/__test__.jsonc
+++ b/tests/specs/run/unstable/__test__.jsonc
@@ -20,6 +20,11 @@
"exitCode": 1,
"output": "kv.out"
},
+ "node_globals": {
+ "args": "run --unstable-node-globals node_globals.ts",
+ "exitCode": 0,
+ "output": "node_globals.out"
+ },
"temporal": {
"args": "run temporal.ts",
"exitCode": 1,
diff --git a/tests/specs/run/unstable/node_globals.out b/tests/specs/run/unstable/node_globals.out
new file mode 100644
index 000000000..77045c7cb
--- /dev/null
+++ b/tests/specs/run/unstable/node_globals.out
@@ -0,0 +1,4 @@
+global: true
+Buffer: true
+setImmediate: true
+clearImmediate: true
diff --git a/tests/specs/run/unstable/node_globals.ts b/tests/specs/run/unstable/node_globals.ts
new file mode 100644
index 000000000..706b7eb65
--- /dev/null
+++ b/tests/specs/run/unstable/node_globals.ts
@@ -0,0 +1,7 @@
+import * as nodeBuffer from "node:buffer";
+import * as nodeTimers from "node:timers";
+
+console.log(`global: ${globalThis === global}`);
+console.log(`Buffer: ${Buffer === nodeBuffer.default}`);
+console.log(`setImmediate: ${setImmediate === nodeTimers.setImmediate}`);
+console.log(`clearImmediate: ${clearImmediate === nodeTimers.clearImmediate}`);