Browse Source

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>
v7.x
Ben Noordhuis 8 years ago
committed by Evan Lucas
parent
commit
21ba3e3b89
  1. 1
      test/fixtures/packages/index/index.js
  2. 1
      test/fixtures/packages/index/package.json
  3. 3
      test/sequential/test-module-loading.js

1
test/fixtures/packages/index/index.js

@ -0,0 +1 @@
exports.ok = 'ok';

1
test/fixtures/packages/index/package.json

@ -0,0 +1 @@
{}

3
test/sequential/test-module-loading.js

@ -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…
Cancel
Save