test: add more module loader test coverage
Verify that a package.json without a .main property loads index.js. PR-URL: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
d1f7c965bb
commit
8fca311857
1
test/fixtures/packages/index/index.js
vendored
Normal file
1
test/fixtures/packages/index/index.js
vendored
Normal file
@ -0,0 +1 @@
|
||||
exports.ok = 'ok';
|
1
test/fixtures/packages/index/package.json
vendored
Normal file
1
test/fixtures/packages/index/package.json
vendored
Normal file
@ -0,0 +1 @@
|
||||
{}
|
@ -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',
|
||||
'Failed loading package');
|
||||
assert.equal(require('../fixtures/packages/main').ok, 'ok',
|
||||
'Failed loading package');
|
||||
assert.equal(require('../fixtures/packages/main-index').ok, 'ok',
|
||||
@ -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': {
|
||||
|
Loading…
x
Reference in New Issue
Block a user