Skip to content

Commit

Permalink
fixup! esm: fix misleading error when import empty package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
himself65 committed Sep 19, 2024
1 parent 77abfd1 commit ce27df1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/es-module/test-cjs-legacyMainResolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,15 @@ describe('legacyMainResolve', () => {
);
assert.throws(
() => legacyMainResolve(packageJsonUrl, { main: null }, packageJsonUrl),
{ message: /index\.js/, code: 'ERR_MODULE_NOT_FOUND' },
{ message: /No package entry point defined for package/, code: 'ERR_MODULE_NOT_FOUND' },
);
});

it('should not crash when cannot resolve to a file that contains special chars', () => {
const packageJsonUrl = pathToFileURL('/c/file%20with%20percents/package.json');
assert.throws(
() => legacyMainResolve(packageJsonUrl, { main: null }, packageJsonUrl),
{ message: /index\.js/, code: 'ERR_MODULE_NOT_FOUND' },
{ message: /No package entry point defined for package/, code: 'ERR_MODULE_NOT_FOUND' },
);
});

Expand All @@ -150,7 +150,7 @@ describe('legacyMainResolve', () => {
);
assert.throws(
() => legacyMainResolve(packageJsonUrl, { main: './index.node' }, packageJsonUrl),
{ message: /index\.node/, code: 'ERR_MODULE_NOT_FOUND' },
{ message: /No package entry point defined for package/, code: 'ERR_MODULE_NOT_FOUND' },
);
});

Expand Down

0 comments on commit ce27df1

Please sign in to comment.