diff --git a/runtime/js/98_global_scope_shared.js b/runtime/js/98_global_scope_shared.js index 7a27238996..5f96d53ddc 100644 --- a/runtime/js/98_global_scope_shared.js +++ b/runtime/js/98_global_scope_shared.js @@ -136,6 +136,7 @@ const windowOrWorkerGlobalScope = { Crypto: core.propNonEnumerable(crypto.Crypto), SubtleCrypto: core.propNonEnumerable(crypto.SubtleCrypto), fetch: core.propWritable(fetch.fetch), + global: core.propWritable(globalThis), EventSource: core.propWritable(eventSource.EventSource), performance: core.propWritable(performance.performance), process: core.propWritable(process), diff --git a/tests/specs/run/globals/__test__.jsonc b/tests/specs/run/globals/__test__.jsonc new file mode 100644 index 0000000000..89d2619720 --- /dev/null +++ b/tests/specs/run/globals/__test__.jsonc @@ -0,0 +1,9 @@ +{ + "tests": { + "has_node_global": { + "args": "run has_node_global.js", + "exitCode": 0, + "output": "has_node_global.out" + } + } +} diff --git a/tests/specs/run/globals/has_node_global.js b/tests/specs/run/globals/has_node_global.js new file mode 100644 index 0000000000..821f3683f9 --- /dev/null +++ b/tests/specs/run/globals/has_node_global.js @@ -0,0 +1 @@ +globalThis === globalThis.global; diff --git a/tests/specs/run/globals/has_node_global.out b/tests/specs/run/globals/has_node_global.out new file mode 100644 index 0000000000..e69de29bb2