node/test/parallel/test-global.js
Anna Henningsen 0fb21df6e6
lib: make String(global) === '[object global]'
This inadvertently changed to `[object Object]` with the V8 upgrade
in 8a24728...96933df. Use `Symbol.toStringTag` to undo this
particular change.

Fixes: https://github.com/nodejs/node/issues/9274
PR-URL: https://github.com/nodejs/node/pull/9279
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-11-02 23:19:31 +01:00

26 lines
835 B
JavaScript

/* eslint-disable strict */
const common = require('../common');
const path = require('path');
const assert = require('assert');
common.globalCheck = false;
baseFoo = 'foo'; // eslint-disable-line no-undef
global.baseBar = 'bar';
assert.strictEqual('foo', global.baseFoo,
'x -> global.x in base level not working');
assert.strictEqual('bar',
baseBar, // eslint-disable-line no-undef
'global.x -> x in base level not working');
var module = require(path.join(common.fixturesDir, 'global', 'plain'));
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]');