From ce27df11eab7dd83328054e51dfdfcb60b7f277b Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Wed, 18 Sep 2024 17:11:50 -0700 Subject: [PATCH] fixup! esm: fix misleading error when import empty package.json --- test/es-module/test-cjs-legacyMainResolve.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/es-module/test-cjs-legacyMainResolve.js b/test/es-module/test-cjs-legacyMainResolve.js index 0bfeb567a22b1f9..48373c01ebe0409 100644 --- a/test/es-module/test-cjs-legacyMainResolve.js +++ b/test/es-module/test-cjs-legacyMainResolve.js @@ -129,7 +129,7 @@ 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' }, ); }); @@ -137,7 +137,7 @@ describe('legacyMainResolve', () => { 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' }, ); }); @@ -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' }, ); });