diff --git a/lib/internal/bootstrap_node.js b/lib/internal/bootstrap_node.js index 8db79aa33fb32a..c8adb39e6b7b26 100644 --- a/lib/internal/bootstrap_node.js +++ b/lib/internal/bootstrap_node.js @@ -188,6 +188,12 @@ } function setupGlobalVariables() { + Object.defineProperty(global, Symbol.toStringTag, { + value: 'global', + writable: false, + enumerable: false, + configurable: true + }); global.process = process; const util = NativeModule.require('util'); diff --git a/test/parallel/test-global.js b/test/parallel/test-global.js index 1bf1bd7cd69303..270faf1b7768a6 100644 --- a/test/parallel/test-global.js +++ b/test/parallel/test-global.js @@ -21,3 +21,5 @@ const fooBar = module.fooBar; assert.strictEqual('foo', fooBar.foo, 'x -> global.x in sub level not working'); assert.strictEqual('bar', fooBar.bar, 'global.x -> x in sub level not working'); + +assert.strictEqual(Object.prototype.toString.call(global), '[object global]');