Skip to content
Closed
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
console : fix jsling issue
  • Loading branch information
Wandalen authored and Trott committed Aug 15, 2017
commit 352d50422e0017ef48055a5f2d7ca9784591b517
1 change: 1 addition & 0 deletions test/parallel/test-console-assing-undefined.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ global.console = undefined;
// lazily loaded in the getter.

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.

make jslint threw an error:

node/test/parallel/test-console-assing-undefined.js
1:1 error Mandatory module "common" must be loaded required-modules

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Adding require common gives "'common' is assigned a value but never used". What would be appropriate resolution of the problem?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Simulating of usage or adding a directive?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Just don't assign it anywhere. Instead of const common = require('../common'); do require('../common');.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aqrln Smart. Do you participate in OdesaJS this year?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@watilde fixed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@Wandalen almost there :) The common module should be the first one that a test requires. Please see our guide on writing tests.

Do you participate in OdessaJS this year?

Yep.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@aqrln I shall share my experience too if organizers won't be mean :)

const assert = require('assert');
require('../common');

// global.console's getter is called
// Since the `console` cache variable is `undefined` and therefore false-y,
Expand Down