From ee904ec06c1a3b3d4e4a87898e777e2f9b587b07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartek=20Iwa=C5=84czuk?= Date: Tue, 15 Oct 2024 22:51:39 +0100 Subject: fix: add hint for missing `document` global in terminal error (#26218) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This came up on Discord as a question so I thought it's worth adding a hint for this as it might be a common pitfall. --------- Signed-off-by: Bartek IwaƄczuk Co-authored-by: David Sherret --- tests/specs/run/document/__test__.jsonc | 9 +++++++++ tests/specs/run/document/document.js | 1 + tests/specs/run/document/document.out | 8 ++++++++ 3 files changed, 18 insertions(+) create mode 100644 tests/specs/run/document/__test__.jsonc create mode 100644 tests/specs/run/document/document.js create mode 100644 tests/specs/run/document/document.out (limited to 'tests/specs/run/document') diff --git a/tests/specs/run/document/__test__.jsonc b/tests/specs/run/document/__test__.jsonc new file mode 100644 index 000000000..cf20f9e1b --- /dev/null +++ b/tests/specs/run/document/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tests": { + "document": { + "args": "run document.js", + "exitCode": 1, + "output": "document.out" + } + } +} diff --git a/tests/specs/run/document/document.js b/tests/specs/run/document/document.js new file mode 100644 index 000000000..63e43b72f --- /dev/null +++ b/tests/specs/run/document/document.js @@ -0,0 +1 @@ +document.querySelector("div"); diff --git a/tests/specs/run/document/document.out b/tests/specs/run/document/document.out new file mode 100644 index 000000000..eefedb8f2 --- /dev/null +++ b/tests/specs/run/document/document.out @@ -0,0 +1,8 @@ +error: Uncaught (in promise) ReferenceError: document is not defined +document.querySelector("div"); +^ + at [WILDCARD]document.js:1:1 + + info: document global is not available in Deno. + hint: Use a library like happy-dom, deno_dom, linkedom or JSDom + and setup the document global according to the library documentation. -- cgit v1.2.3