@@ -280,6 +280,86 @@ test("install should dedupe dependencies avoiding conflicts 5", () => {
280
280
} ) ;
281
281
} ) ;
282
282
283
+ test ( "install should dedupe dependencies avoiding conflicts 6 (jest/jest-runtime case)" , ( ) => {
284
+ // C@1 -> D@1 -> E@1
285
+ // B@1 -> C@1 -> D@1 -> E@1
286
+ // D@2
287
+ // E@2
288
+
289
+ // should become
290
+
291
+ // C@1 -> D@1
292
+ // -> E@1
293
+ // B@1
294
+ // D@2
295
+ // E@2
296
+
297
+ return run ( { } , [ ] , "install-should-dedupe-avoiding-conflicts-6" , async ( config ) => {
298
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
299
+ "node_modules/dep-b/package.json" ) ) ) . version , "1.0.0" ) ;
300
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
301
+ "node_modules/dep-c/package.json" ) ) ) . version , "1.0.0" ) ;
302
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
303
+ "node_modules/dep-d/package.json" ) ) ) . version , "2.0.0" ) ;
304
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
305
+ "node_modules/dep-e/package.json" ) ) ) . version , "2.0.0" ) ;
306
+
307
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
308
+ "node_modules/dep-c/node_modules/dep-d/package.json" ) ) ) . version , "1.0.0" ) ;
309
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
310
+ "node_modules/dep-c/node_modules/dep-e/package.json" ) ) ) . version , "1.0.0" ) ;
311
+ } ) ;
312
+ } ) ;
313
+
314
+ test ( "install should dedupe dependencies avoiding conflicts 7" , ( ) => {
315
+ // A@1 -> C@1 -> D@1 -> E@1
316
+ // B@1 -> C@1 -> D@1 -> E@1
317
+ // C@2
318
+ // D@2
319
+ // E@2
320
+
321
+ // should become
322
+
323
+ // A@1 -> C@1
324
+ // -> D@1
325
+ // -> E@1
326
+ // B@1 -> C@1
327
+ // -> D@1
328
+ // -> E@1
329
+ // C@2
330
+ // D@2
331
+ // E@2
332
+
333
+ return run ( { } , [ ] , "install-should-dedupe-avoiding-conflicts-7" , async ( config ) => {
334
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
335
+ "node_modules/dep-a/package.json" ) ) ) . version , "1.0.0" ) ;
336
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
337
+ "node_modules/dep-b/package.json" ) ) ) . version , "1.0.0" ) ;
338
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
339
+ "node_modules/dep-c/package.json" ) ) ) . version , "2.0.0" ) ;
340
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
341
+ "node_modules/dep-d/package.json" ) ) ) . version , "2.0.0" ) ;
342
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
343
+ "node_modules/dep-e/package.json" ) ) ) . version , "2.0.0" ) ;
344
+
345
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
346
+ "node_modules/dep-a/node_modules/dep-c/package.json" ) ) ) . version , "1.0.0" ) ;
347
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
348
+ "node_modules/dep-a/node_modules/dep-d/package.json" ) ) ) . version , "1.0.0" ) ;
349
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
350
+ "node_modules/dep-a/node_modules/dep-e/package.json" ) ) ) . version , "1.0.0" ) ;
351
+
352
+
353
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
354
+ "node_modules/dep-b/node_modules/dep-c/package.json" ) ) ) . version , "1.0.0" ) ;
355
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
356
+ "node_modules/dep-b/node_modules/dep-d/package.json" ) ) ) . version , "1.0.0" ) ;
357
+ assert . equal ( JSON . parse ( await fs . readFile ( path . join ( config . cwd ,
358
+ "node_modules/dep-b/node_modules/dep-e/package.json" ) ) ) . version , "1.0.0" ) ;
359
+
360
+ } ) ;
361
+ } ) ;
362
+
283
363
test ( "upgrade scenario" , ( ) => {
284
364
// left-pad first installed 0.0.9 then updated to 1.1.0
285
365
// files in mirror, fbkpm.lock, package.json and node_modules should reflect that
0 commit comments