@@ -33,37 +33,43 @@ describe('ESM: --experimental-package-map', () => {
3333 describe ( 'basic resolution' , ( ) => {
3434 it ( 'resolves a direct dependency' , async ( ) => {
3535 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
36+ '--no-warnings' ,
3637 '--experimental-package-map' , packageMapPath ,
3738 '--input-type=module' ,
3839 '--eval' ,
3940 `import dep from 'dep-a'; console.log(dep);` ,
4041 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
4142
43+ assert . strictEqual ( stderr , '' ) ;
4244 assert . match ( stdout , / d e p - a - v a l u e / ) ;
4345 assert . strictEqual ( code , 0 , stderr ) ;
4446 } ) ;
4547
4648 it ( 'resolves a subpath export' , async ( ) => {
4749 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
50+ '--no-warnings' ,
4851 '--experimental-package-map' , packageMapPath ,
4952 '--input-type=module' ,
5053 '--eval' ,
5154 `import util from 'dep-a/lib/util'; console.log(util);` ,
5255 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
5356
57+ assert . strictEqual ( stderr , '' ) ;
5458 assert . match ( stdout , / d e p - a - u t i l / ) ;
5559 assert . strictEqual ( code , 0 , stderr ) ;
5660 } ) ;
5761
5862 it ( 'resolves transitive dependency from allowed package' , async ( ) => {
5963 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
64+ '--no-warnings' ,
6065 '--experimental-package-map' , packageMapPath ,
6166 '--input-type=module' ,
6267 '--eval' ,
6368 // dep-b can access dep-a
6469 `import depB from 'dep-b'; console.log(depB);` ,
6570 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
6671
72+ assert . strictEqual ( stderr , '' ) ;
6773 assert . match ( stdout , / d e p - b u s i n g d e p - a - v a l u e / ) ;
6874 assert . strictEqual ( code , 0 , stderr ) ;
6975 } ) ;
@@ -74,18 +80,21 @@ describe('ESM: --experimental-package-map', () => {
7480 describe ( 'resolution boundaries' , ( ) => {
7581 it ( 'falls back for builtin modules' , async ( ) => {
7682 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
83+ '--no-warnings' ,
7784 '--experimental-package-map' , packageMapPath ,
7885 '--input-type=module' ,
7986 '--eval' ,
8087 `import fs from 'node:fs'; console.log(typeof fs.readFileSync);` ,
8188 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
8289
90+ assert . strictEqual ( stderr , '' ) ;
8391 assert . match ( stdout , / f u n c t i o n / ) ;
8492 assert . strictEqual ( code , 0 , stderr ) ;
8593 } ) ;
8694
8795 it ( 'throws when parent not in map' , async ( ) => {
8896 const { code, stderr } = await spawnPromisified ( execPath , [
97+ '--no-warnings' ,
8998 '--experimental-package-map' , packageMapPath ,
9099 '--input-type=module' ,
91100 '--eval' ,
@@ -102,6 +111,7 @@ describe('ESM: --experimental-package-map', () => {
102111 describe ( 'error handling' , ( ) => {
103112 it ( 'throws ERR_PACKAGE_MAP_INVALID for invalid JSON' , async ( ) => {
104113 const { code, stderr } = await spawnPromisified ( execPath , [
114+ '--no-warnings' ,
105115 '--experimental-package-map' ,
106116 fixtures . path ( 'package-map/package-map-invalid-syntax.json' ) ,
107117 '--input-type=module' ,
@@ -114,6 +124,7 @@ describe('ESM: --experimental-package-map', () => {
114124
115125 it ( 'throws ERR_PACKAGE_MAP_INVALID for missing packages field' , async ( ) => {
116126 const { code, stderr } = await spawnPromisified ( execPath , [
127+ '--no-warnings' ,
117128 '--experimental-package-map' ,
118129 fixtures . path ( 'package-map/package-map-invalid-schema.json' ) ,
119130 '--input-type=module' ,
@@ -127,6 +138,7 @@ describe('ESM: --experimental-package-map', () => {
127138
128139 it ( 'throws ERR_PACKAGE_MAP_KEY_NOT_FOUND for undefined dependency key' , async ( ) => {
129140 const { code, stderr } = await spawnPromisified ( execPath , [
141+ '--no-warnings' ,
130142 '--experimental-package-map' ,
131143 fixtures . path ( 'package-map/package-map-missing-dep.json' ) ,
132144 '--input-type=module' ,
@@ -140,6 +152,7 @@ describe('ESM: --experimental-package-map', () => {
140152
141153 it ( 'throws for non-existent map file' , async ( ) => {
142154 const { code, stderr } = await spawnPromisified ( execPath , [
155+ '--no-warnings' ,
143156 '--experimental-package-map' , '/nonexistent/package-map.json' ,
144157 '--input-type=module' ,
145158 '--eval' , `import x from 'dep-a';` ,
@@ -152,6 +165,7 @@ describe('ESM: --experimental-package-map', () => {
152165
153166 it ( 'throws ERR_PACKAGE_MAP_INVALID for unsupported URL scheme in path' , async ( ) => {
154167 const { code, stderr } = await spawnPromisified ( execPath , [
168+ '--no-warnings' ,
155169 '--experimental-package-map' ,
156170 fixtures . path ( 'package-map/package-map-https-path.json' ) ,
157171 '--input-type=module' ,
@@ -166,18 +180,21 @@ describe('ESM: --experimental-package-map', () => {
166180
167181 it ( 'accepts file:// URLs in path' , async ( ) => {
168182 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
183+ '--no-warnings' ,
169184 '--experimental-package-map' , fileUrlFixturePath ,
170185 '--input-type=module' ,
171186 '--eval' ,
172187 `import dep from 'dep-a'; console.log(dep);` ,
173188 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
174189
190+ assert . strictEqual ( stderr , '' ) ;
175191 assert . match ( stdout , / d e p - a - v a l u e / ) ;
176192 assert . strictEqual ( code , 0 , stderr ) ;
177193 } ) ;
178194
179195 it ( 'throws ERR_PACKAGE_MAP_INVALID for duplicate package paths' , async ( ) => {
180196 const { code, stderr } = await spawnPromisified ( execPath , [
197+ '--no-warnings' ,
181198 '--experimental-package-map' ,
182199 fixtures . path ( 'package-map/package-map-duplicate-path.json' ) ,
183200 '--input-type=module' ,
@@ -196,11 +213,13 @@ describe('ESM: --experimental-package-map', () => {
196213 describe ( 'disabled by default' , ( ) => {
197214 it ( 'has no impact when flag not set' , async ( ) => {
198215 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
216+ '--no-warnings' ,
199217 '--input-type=module' ,
200218 '--eval' ,
201219 `import fs from 'node:fs'; console.log('ok');` ,
202220 ] ) ;
203221
222+ assert . strictEqual ( stderr , '' ) ;
204223 assert . match ( stdout , / o k / ) ;
205224 assert . strictEqual ( code , 0 , stderr ) ;
206225 } ) ;
@@ -211,24 +230,28 @@ describe('ESM: --experimental-package-map', () => {
211230 describe ( 'package.json exports integration' , ( ) => {
212231 it ( 'respects conditional exports (import)' , async ( ) => {
213232 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
233+ '--no-warnings' ,
214234 '--experimental-package-map' , packageMapPath ,
215235 '--input-type=module' ,
216236 '--eval' ,
217237 `import { format } from 'dep-a'; console.log(format);` ,
218238 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
219239
240+ assert . strictEqual ( stderr , '' ) ;
220241 assert . match ( stdout , / e s m / ) ; // Should get ESM export
221242 assert . strictEqual ( code , 0 , stderr ) ;
222243 } ) ;
223244
224245 it ( 'respects pattern exports' , async ( ) => {
225246 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
247+ '--no-warnings' ,
226248 '--experimental-package-map' , packageMapPath ,
227249 '--input-type=module' ,
228250 '--eval' ,
229251 `import util from 'dep-a/lib/util'; console.log(util);` ,
230252 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
231253
254+ assert . strictEqual ( stderr , '' ) ;
232255 assert . match ( stdout , / d e p - a - u t i l / ) ;
233256 assert . strictEqual ( code , 0 , stderr ) ;
234257 } ) ;
@@ -259,13 +282,15 @@ describe('ESM: --experimental-package-map', () => {
259282 // incorrectly matched as inside pkg (at ./pkg) just because
260283 // the string "./pkg-other" starts with "./pkg"
261284 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
285+ '--no-warnings' ,
262286 '--experimental-package-map' ,
263287 fixtures . path ( 'package-map/package-map-path-prefix.json' ) ,
264288 '--input-type=module' ,
265289 '--eval' ,
266290 `import pkg from 'pkg'; console.log(pkg);` ,
267291 ] , { cwd : fixtures . path ( 'package-map/pkg-other' ) } ) ;
268292
293+ assert . strictEqual ( stderr , '' ) ;
269294 assert . match ( stdout , / p k g - v a l u e / ) ;
270295 assert . strictEqual ( code , 0 , stderr ) ;
271296 } ) ;
@@ -276,13 +301,15 @@ describe('ESM: --experimental-package-map', () => {
276301 describe ( 'external package paths' , ( ) => {
277302 it ( 'resolves packages outside the package map directory via relative paths' , async ( ) => {
278303 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
304+ '--no-warnings' ,
279305 '--experimental-package-map' ,
280306 fixtures . path ( 'package-map/nested-project/package-map-external-deps.json' ) ,
281307 '--input-type=module' ,
282308 '--eval' ,
283309 `import dep from 'dep-a'; console.log(dep);` ,
284310 ] , { cwd : fixtures . path ( 'package-map/nested-project/src' ) } ) ;
285311
312+ assert . strictEqual ( stderr , '' ) ;
286313 assert . match ( stdout , / d e p - a - v a l u e / ) ;
287314 assert . strictEqual ( code , 0 , stderr ) ;
288315 } ) ;
@@ -297,12 +324,14 @@ describe('ESM: --experimental-package-map', () => {
297324 // app-18 and app-19 both import 'react', but the package map wires
298325 // them to react@18 and react@19 respectively.
299326 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
327+ '--no-warnings' ,
300328 '--experimental-package-map' , versionForkMap ,
301329 '--input-type=module' ,
302330 '--eval' ,
303331 `import app18 from 'app-18'; import app19 from 'app-19'; console.log(app18); console.log(app19);` ,
304332 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
305333
334+ assert . strictEqual ( stderr , '' ) ;
306335 assert . match ( stdout , / a p p - 1 8 u s i n g r e a c t 1 8 / ) ;
307336 assert . match ( stdout , / a p p - 1 9 u s i n g r e a c t 1 9 / ) ;
308337 assert . strictEqual ( code , 0 , stderr ) ;
@@ -319,12 +348,14 @@ describe('ESM: --experimental-package-map', () => {
319348 // path (./root). The longest matching path should win, so code in
320349 // inner should resolve dep-a (inner's dep), not be treated as root.
321350 const { code, stdout, stderr } = await spawnPromisified ( execPath , [
351+ '--no-warnings' ,
322352 '--experimental-package-map' , longestPathMap ,
323353 '--input-type=module' ,
324354 '--eval' ,
325355 `import inner from 'inner'; console.log(inner);` ,
326356 ] , { cwd : fixtures . path ( 'package-map/root' ) } ) ;
327357
358+ assert . strictEqual ( stderr , '' ) ;
328359 assert . match ( stdout , / i n n e r u s i n g d e p - a - v a l u e / ) ;
329360 assert . strictEqual ( code , 0 , stderr ) ;
330361 } ) ;
@@ -333,6 +364,7 @@ describe('ESM: --experimental-package-map', () => {
333364 // Root does not list dep-a in its dependencies, so importing it
334365 // from root should fail with ERR_MODULE_NOT_FOUND.
335366 const { code, stderr } = await spawnPromisified ( execPath , [
367+ '--no-warnings' ,
336368 '--experimental-package-map' , longestPathMap ,
337369 '--input-type=module' ,
338370 '--eval' ,
0 commit comments