summaryrefslogtreecommitdiff
path: root/tests/unit/globals_test.ts
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-07-09 10:07:56 -0700
committerGitHub <noreply@github.com>2024-07-09 10:07:56 -0700
commitc461f8fd2e36904b3334c9705726b713712f4a69 (patch)
tree796892fa6c0427b959e4350ed01bbe4597694779 /tests/unit/globals_test.ts
parent839caf6fafdf9ca1cdec6cd9cef38296be41145f (diff)
fix: do not return undefined for missing global properties (#24474)
accessing e.g. `Buffer` in `Mode::Deno` mode should throw, not return undefined. --------- Signed-off-by: snek <snek@deno.com>
Diffstat (limited to 'tests/unit/globals_test.ts')
-rw-r--r--tests/unit/globals_test.ts14
1 files changed, 13 insertions, 1 deletions
diff --git a/tests/unit/globals_test.ts b/tests/unit/globals_test.ts
index 8e07cf005..e4cbe7daf 100644
--- a/tests/unit/globals_test.ts
+++ b/tests/unit/globals_test.ts
@@ -1,7 +1,12 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// deno-lint-ignore-file no-window-prefix no-window
-import { assert, assertEquals, assertRejects } from "./test_util.ts";
+import {
+ assert,
+ assertEquals,
+ assertRejects,
+ assertThrows,
+} from "./test_util.ts";
Deno.test(function globalThisExists() {
assert(globalThis != null);
@@ -224,3 +229,10 @@ Deno.test(function mapGroupBy() {
quantity: 5,
}]);
});
+
+Deno.test(function nodeGlobalsRaise() {
+ assertThrows(() => {
+ // @ts-ignore yes that's the point
+ Buffer;
+ }, ReferenceError);
+});