Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
test: add more module loader test coverage
Verify that a package.json without a .main property loads index.js.

PR-URL: #9196
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
bnoordhuis committed Oct 24, 2016
commit 8fca311857f0aefbba3782cef6a9812aa784d33f
1 change: 1 addition & 0 deletions test/fixtures/packages/index/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exports.ok = 'ok';
1 change: 1 addition & 0 deletions test/fixtures/packages/index/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
3 changes: 3 additions & 0 deletions test/sequential/test-module-loading.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ assert.equal(threeFolder, threeIndex);
assert.notEqual(threeFolder, three);

console.error('test package.json require() loading');
assert.equal(require('../fixtures/packages/index').ok, 'ok',
Copy link
Copy Markdown
Member

@jasnell jasnell Oct 20, 2016

Choose a reason for hiding this comment

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

strictEqual?
I know equal is consistent with the rest of the test but updating the test may be worthwhile

Copy link
Copy Markdown
Member Author

@bnoordhuis bnoordhuis Oct 20, 2016

Choose a reason for hiding this comment

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

I followed the style of the surrounding code here.

EDIT: Never mind, didn't see you edited your comment. Still, consistency is important, right?

Copy link
Copy Markdown
Member Author

@bnoordhuis bnoordhuis Oct 24, 2016

Choose a reason for hiding this comment

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

I'll update the test en bloc in a separate pull request.

EDIT: #9263

'Failed loading package');
assert.equal(require('../fixtures/packages/main').ok, 'ok',
'Failed loading package');
assert.equal(require('../fixtures/packages/main-index').ok, 'ok',
Expand Down Expand Up @@ -208,6 +210,7 @@ assert.deepStrictEqual(children, {
},
'fixtures/nested-index/three.js': {},
'fixtures/nested-index/three/index.js': {},
'fixtures/packages/index/index.js': {},
'fixtures/packages/main/package-main-module.js': {},
'fixtures/packages/main-index/package-main-module/index.js': {},
'fixtures/cycles/root.js': {
Expand Down