test: improve assert messages in test-global

PR-URL: https://github.com/nodejs/node/pull/16843
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Mark McNelis 2017-11-06 18:22:57 +00:00 committed by Rich Trott
parent 3d7f0fe67f
commit 9468108ebd

View File

@ -34,17 +34,18 @@ baseFoo = 'foo'; // eslint-disable-line no-undef
global.baseBar = 'bar';
assert.strictEqual(global.baseFoo, 'foo',
'x -> global.x in base level not working');
`x -> global.x failed: global.baseFoo = ${global.baseFoo}`);
assert.strictEqual(baseBar, // eslint-disable-line no-undef
'bar',
'global.x -> x in base level not working');
// eslint-disable-next-line no-undef
`global.x -> x failed: baseBar = ${baseBar}`);
const mod = require(fixtures.path('global', 'plain'));
const fooBar = mod.fooBar;
assert.strictEqual(fooBar.foo, 'foo', 'x -> global.x in sub level not working');
assert.strictEqual(fooBar.foo, 'foo');
assert.strictEqual(fooBar.bar, 'bar', 'global.x -> x in sub level not working');
assert.strictEqual(fooBar.bar, 'bar');
assert.strictEqual(Object.prototype.toString.call(global), '[object global]');