Skip to content
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions test/parallel/test-global.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,21 @@ baseFoo = 'foo'; // eslint-disable-line no-undef
global.baseBar = 'bar';

assert.strictEqual(global.baseFoo, 'foo',
'x -> global.x in base level not working');
// eslint-disable-next-line no-undef
`${baseFoo} -> global.baseFoo in base level not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would result in very confusing message, IMO. I think you might be misunderstanding the original error message text.

Try removing the eslint-disable-line comment that was added and using something like this for the message instead:

`x -> global.x failed: global.baseDir = ${global.baseDir}`

working`);

assert.strictEqual(baseBar, // eslint-disable-line no-undef
'bar',
'global.x -> x in base level not working');
// eslint-disable-next-line no-undef
`${global.baseBar} -> baseBar in base level not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This too will be very confusing: "bar -> baseBar in base level not working"....huh?

Try something like this instead:

`global.x -> x failed: baseBar = ${baseBar}`

working`);

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]');