summaryrefslogtreecommitdiff
path: root/tests/specs/run/node_globals_hints
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs/run/node_globals_hints')
-rw-r--r--tests/specs/run/node_globals_hints/__test__.jsonc34
-rw-r--r--tests/specs/run/node_globals_hints/buffer.js1
-rw-r--r--tests/specs/run/node_globals_hints/buffer.out8
-rw-r--r--tests/specs/run/node_globals_hints/clear_immediate.js1
-rw-r--r--tests/specs/run/node_globals_hints/clear_immediate.out8
-rw-r--r--tests/specs/run/node_globals_hints/dirname.js1
-rw-r--r--tests/specs/run/node_globals_hints/dirname.out7
-rw-r--r--tests/specs/run/node_globals_hints/filename.js1
-rw-r--r--tests/specs/run/node_globals_hints/filename.out7
-rw-r--r--tests/specs/run/node_globals_hints/global.js1
-rw-r--r--tests/specs/run/node_globals_hints/global.out8
-rw-r--r--tests/specs/run/node_globals_hints/set_immediate.js1
-rw-r--r--tests/specs/run/node_globals_hints/set_immediate.out8
13 files changed, 86 insertions, 0 deletions
diff --git a/tests/specs/run/node_globals_hints/__test__.jsonc b/tests/specs/run/node_globals_hints/__test__.jsonc
new file mode 100644
index 000000000..c5c5d6e42
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/__test__.jsonc
@@ -0,0 +1,34 @@
+{
+ "tests": {
+ "__dirname": {
+ "args": "run dirname.js",
+ "output": "dirname.out",
+ "exitCode": 1
+ },
+ "__filename": {
+ "args": "run filename.js",
+ "output": "filename.out",
+ "exitCode": 1
+ },
+ "clearImmediate": {
+ "args": "run clear_immediate.js",
+ "output": "clear_immediate.out",
+ "exitCode": 1
+ },
+ "buffer": {
+ "args": "run buffer.js",
+ "output": "buffer.out",
+ "exitCode": 1
+ },
+ "global": {
+ "args": "run global.js",
+ "output": "global.out",
+ "exitCode": 1
+ },
+ "setImmediate": {
+ "args": "run set_immediate.js",
+ "output": "set_immediate.out",
+ "exitCode": 1
+ }
+ }
+}
diff --git a/tests/specs/run/node_globals_hints/buffer.js b/tests/specs/run/node_globals_hints/buffer.js
new file mode 100644
index 000000000..9809e1656
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/buffer.js
@@ -0,0 +1 @@
+Buffer;
diff --git a/tests/specs/run/node_globals_hints/buffer.out b/tests/specs/run/node_globals_hints/buffer.out
new file mode 100644
index 000000000..858f404ab
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/buffer.out
@@ -0,0 +1,8 @@
+error: Uncaught (in promise) ReferenceError: Buffer is not defined
+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";,
+ or run again with --unstable-node-globals flag to add this global.
diff --git a/tests/specs/run/node_globals_hints/clear_immediate.js b/tests/specs/run/node_globals_hints/clear_immediate.js
new file mode 100644
index 000000000..94b26ae68
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/clear_immediate.js
@@ -0,0 +1 @@
+clearImmediate;
diff --git a/tests/specs/run/node_globals_hints/clear_immediate.out b/tests/specs/run/node_globals_hints/clear_immediate.out
new file mode 100644
index 000000000..a973a3172
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/clear_immediate.out
@@ -0,0 +1,8 @@
+error: Uncaught (in promise) ReferenceError: clearImmediate is not defined
+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";,
+ or run again with --unstable-node-globals flag to add this global.
diff --git a/tests/specs/run/node_globals_hints/dirname.js b/tests/specs/run/node_globals_hints/dirname.js
new file mode 100644
index 000000000..58d9e9379
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/dirname.js
@@ -0,0 +1 @@
+__dirname;
diff --git a/tests/specs/run/node_globals_hints/dirname.out b/tests/specs/run/node_globals_hints/dirname.out
new file mode 100644
index 000000000..0aa3e4f51
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/dirname.out
@@ -0,0 +1,7 @@
+error: Uncaught (in promise) ReferenceError: __dirname is not defined
+__dirname;
+^
+ at [WILDCARD]dirname.js:1:1
+
+ info: __dirname global is not available in ES modules.
+ hint: Use import.meta.dirname instead.
diff --git a/tests/specs/run/node_globals_hints/filename.js b/tests/specs/run/node_globals_hints/filename.js
new file mode 100644
index 000000000..31770bb14
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/filename.js
@@ -0,0 +1 @@
+__filename;
diff --git a/tests/specs/run/node_globals_hints/filename.out b/tests/specs/run/node_globals_hints/filename.out
new file mode 100644
index 000000000..47b4264fb
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/filename.out
@@ -0,0 +1,7 @@
+error: Uncaught (in promise) ReferenceError: __filename is not defined
+__filename;
+^
+ at [WILDCARD]filename.js:1:1
+
+ info: __filename global is not available in ES modules.
+ hint: Use import.meta.filename instead.
diff --git a/tests/specs/run/node_globals_hints/global.js b/tests/specs/run/node_globals_hints/global.js
new file mode 100644
index 000000000..56676d726
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/global.js
@@ -0,0 +1 @@
+global;
diff --git a/tests/specs/run/node_globals_hints/global.out b/tests/specs/run/node_globals_hints/global.out
new file mode 100644
index 000000000..ad01ac426
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/global.out
@@ -0,0 +1,8 @@
+error: Uncaught (in promise) ReferenceError: global is not defined
+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,
+ or run again with --unstable-node-globals flag to add this global.
diff --git a/tests/specs/run/node_globals_hints/set_immediate.js b/tests/specs/run/node_globals_hints/set_immediate.js
new file mode 100644
index 000000000..fa29d1e71
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/set_immediate.js
@@ -0,0 +1 @@
+setImmediate;
diff --git a/tests/specs/run/node_globals_hints/set_immediate.out b/tests/specs/run/node_globals_hints/set_immediate.out
new file mode 100644
index 000000000..b3feb3127
--- /dev/null
+++ b/tests/specs/run/node_globals_hints/set_immediate.out
@@ -0,0 +1,8 @@
+error: Uncaught (in promise) ReferenceError: setImmediate is not defined
+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";,
+ or run again with --unstable-node-globals flag to add this global.