node/test/parallel/test-global.js
cjihrig ff1efa6087 test: use const for all require() calls
PR-URL: https://github.com/nodejs/node/pull/10550
Reviewed-By: Rich Trott <rtrott@gmail.com>
2017-01-02 18:28:18 -05:00

26 lines
831 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');
const mod = require(path.join(common.fixturesDir, 'global', 'plain'));
const fooBar = mod.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]');