@@ -79,6 +79,7 @@ describe('CJS: --experimental-package-map', { concurrency: !process.env.TEST_PAR
7979 assert . match ( stdout , / d e p - b u s i n g d e p - a - v a l u e / ) ;
8080 assert . strictEqual ( status , 0 , stderr ) ;
8181 } ) ;
82+
8283 } ) ;
8384
8485 describe ( 'resolution boundaries' , ( ) => {
@@ -300,6 +301,22 @@ describe('CJS: --experimental-package-map', { concurrency: !process.env.TEST_PAR
300301 describe ( 'longest path wins' , ( ) => {
301302 const longestPathMap = fixtures . path ( 'package-map/package-map-longest-path.json' ) ;
302303
304+ it ( 'resolves from createRequire() paths with mixed separators' , ( ) => {
305+ const { status, stdout, stderr } = spawnSync ( process . execPath , [
306+ '--no-warnings' ,
307+ '--experimental-package-map' , longestPathMap ,
308+ '-e' ,
309+ `const { createRequire } = require('node:module'); const req = createRequire(process.cwd() + '/node_modules/inner/index.js'); const dep = req('dep-a'); console.log(dep.default);` ,
310+ ] , {
311+ cwd : fixtures . path ( 'package-map/root' ) ,
312+ encoding : 'utf8' ,
313+ } ) ;
314+
315+ assert . strictEqual ( stderr , '' ) ;
316+ assert . match ( stdout , / d e p - a - v a l u e / ) ;
317+ assert . strictEqual ( status , 0 , stderr ) ;
318+ } ) ;
319+
303320 it ( 'resolves nested package using its own dependencies, not the parent' , ( ) => {
304321 // Inner lives at ./root/node_modules/inner which is inside root's
305322 // path (./root). The longest matching path should win, so code in
0 commit comments