Skip to content

Commit

Permalink
fixup! module: fix inconsistency between load and _findPath
Browse files Browse the repository at this point in the history
  • Loading branch information
lundibundi committed Aug 22, 2018
1 parent 1b51f7e commit b009708
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/parallel/test-module-deleted-extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ fs.writeFileSync(file, '', 'utf8');
}

{
require.extensions['.bar'] = common.mustNotCall();
require.extensions['.foo.bar'] = common.mustNotCall();
delete require.extensions['.bar'];
require.extensions['.foo.bar'] = common.mustNotCall();
const modulePath = path.join(tmpdir.path, 'test-extensions');
assert.throws(
() => require(modulePath),
new Error(`Cannot find module '${modulePath}'`)
);
assert.throws(
() => require(modulePath + '.foo'),
new Error(`Cannot find module '${modulePath}.foo'`)
);
}

{
require.extensions['.foo.bar'] = common.mustNotCall();
delete require.extensions['.bar'];
delete require.extensions['.foo.bar'];
const modulePath = path.join(tmpdir.path, 'test-extensions');
assert.throws(
Expand All @@ -44,6 +47,7 @@ fs.writeFileSync(file, '', 'utf8');
}

{
delete require.extensions['.foo.bar'];
require.extensions['.bar'] = common.mustCall((module, path) => {
assert.strictEqual(module.id, file);
assert.strictEqual(path, file);
Expand Down

0 comments on commit b009708

Please sign in to comment.