summaryrefslogtreecommitdiff
path: root/test/parallel/test-global.js
blob: 9ebbd0f604434d7ba8be06d052ac3a136636e519 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/* 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');