@@ -422,6 +422,84 @@ describe("apply release plan", () => {
422422 }
423423 } ) ;
424424 } ) ;
425+ it ( "should still update min version ranges of patch bumped internal dependencies that have left semver range" , async ( ) => {
426+ let { changedFiles } = await testSetup (
427+ "internal-dependencies" ,
428+ {
429+ changesets : [
430+ {
431+ id : "quick-lions-devour" ,
432+ summary : "Hey, let's have fun with testing!" ,
433+ releases : [
434+ { name : "pkg-a" , type : "patch" } ,
435+ { name : "pkg-b" , type : "patch" } ,
436+ { name : "pkg-c" , type : "patch" }
437+ ]
438+ }
439+ ] ,
440+ releases : [
441+ {
442+ name : "pkg-a" ,
443+ type : "patch" ,
444+ oldVersion : "1.0.3" ,
445+ newVersion : "1.0.4" ,
446+ changesets : [ "quick-lions-devour" ]
447+ } ,
448+ {
449+ name : "pkg-b" ,
450+ type : "none" ,
451+ oldVersion : "1.2.0" ,
452+ newVersion : "1.2.0" ,
453+ changesets : [ "quick-lions-devour" ]
454+ } ,
455+ {
456+ name : "pkg-c" ,
457+ type : "patch" ,
458+ oldVersion : "2.0.0" ,
459+ newVersion : "2.0.1" ,
460+ changesets : [ "quick-lions-devour" ]
461+ }
462+ ] ,
463+ preState : undefined
464+ } ,
465+ {
466+ changelog : false ,
467+ commit : false ,
468+ linked : [ ] ,
469+ access : "restricted" ,
470+ baseBranch : "master" ,
471+ updateInternalDependencies
472+ }
473+ ) ;
474+ let pkgPathA = changedFiles . find ( a =>
475+ a . endsWith ( `pkg-a${ path . sep } package.json` )
476+ ) ;
477+ let pkgPathB = changedFiles . find ( b =>
478+ b . endsWith ( `pkg-b${ path . sep } package.json` )
479+ ) ;
480+
481+ if ( ! pkgPathA || ! pkgPathB ) {
482+ throw new Error ( `could not find an updated package json` ) ;
483+ }
484+ let pkgJSONA = await fs . readJSON ( pkgPathA ) ;
485+ let pkgJSONB = await fs . readJSON ( pkgPathB ) ;
486+
487+ expect ( pkgJSONA ) . toMatchObject ( {
488+ name : "pkg-a" ,
489+ version : "1.0.4" ,
490+ dependencies : {
491+ "pkg-b" : "~1.2.0"
492+ }
493+ } ) ;
494+ expect ( pkgJSONB ) . toMatchObject ( {
495+ name : "pkg-b" ,
496+ version : "1.2.0" ,
497+ dependencies : {
498+ "pkg-c" : "2.0.1" ,
499+ "pkg-a" : "^1.0.4"
500+ }
501+ } ) ;
502+ } ) ;
425503 it ( "should update min version ranges of minor bumped internal dependencies" , async ( ) => {
426504 let { changedFiles } = await testSetup (
427505 "internal-dependencies" ,
@@ -635,6 +713,84 @@ describe("apply release plan", () => {
635713 }
636714 } ) ;
637715 } ) ;
716+ it ( "should still update min version ranges of patch bumped internal dependencies that have left semver range" , async ( ) => {
717+ let { changedFiles } = await testSetup (
718+ "internal-dependencies" ,
719+ {
720+ changesets : [
721+ {
722+ id : "quick-lions-devour" ,
723+ summary : "Hey, let's have fun with testing!" ,
724+ releases : [
725+ { name : "pkg-a" , type : "patch" } ,
726+ { name : "pkg-b" , type : "patch" } ,
727+ { name : "pkg-c" , type : "patch" }
728+ ]
729+ }
730+ ] ,
731+ releases : [
732+ {
733+ name : "pkg-a" ,
734+ type : "patch" ,
735+ oldVersion : "1.0.3" ,
736+ newVersion : "1.0.4" ,
737+ changesets : [ "quick-lions-devour" ]
738+ } ,
739+ {
740+ name : "pkg-b" ,
741+ type : "patch" ,
742+ oldVersion : "1.2.0" ,
743+ newVersion : "1.2.1" ,
744+ changesets : [ "quick-lions-devour" ]
745+ } ,
746+ {
747+ name : "pkg-c" ,
748+ type : "patch" ,
749+ oldVersion : "2.0.0" ,
750+ newVersion : "2.0.1" ,
751+ changesets : [ "quick-lions-devour" ]
752+ }
753+ ] ,
754+ preState : undefined
755+ } ,
756+ {
757+ changelog : false ,
758+ commit : false ,
759+ linked : [ ] ,
760+ access : "restricted" ,
761+ baseBranch : "master" ,
762+ updateInternalDependencies
763+ }
764+ ) ;
765+ let pkgPathA = changedFiles . find ( a =>
766+ a . endsWith ( `pkg-a${ path . sep } package.json` )
767+ ) ;
768+ let pkgPathB = changedFiles . find ( b =>
769+ b . endsWith ( `pkg-b${ path . sep } package.json` )
770+ ) ;
771+
772+ if ( ! pkgPathA || ! pkgPathB ) {
773+ throw new Error ( `could not find an updated package json` ) ;
774+ }
775+ let pkgJSONA = await fs . readJSON ( pkgPathA ) ;
776+ let pkgJSONB = await fs . readJSON ( pkgPathB ) ;
777+
778+ expect ( pkgJSONA ) . toMatchObject ( {
779+ name : "pkg-a" ,
780+ version : "1.0.4" ,
781+ dependencies : {
782+ "pkg-b" : "~1.2.0"
783+ }
784+ } ) ;
785+ expect ( pkgJSONB ) . toMatchObject ( {
786+ name : "pkg-b" ,
787+ version : "1.2.1" ,
788+ dependencies : {
789+ "pkg-c" : "2.0.1" ,
790+ "pkg-a" : "^1.0.3"
791+ }
792+ } ) ;
793+ } ) ;
638794 it ( "should update min version ranges of minor bumped internal dependencies" , async ( ) => {
639795 let { changedFiles } = await testSetup (
640796 "internal-dependencies" ,
@@ -1198,6 +1354,99 @@ describe("apply release plan", () => {
11981354
11991355 - Hey, let's have fun with testing!` ) ;
12001356 } ) ;
1357+
1358+ it ( "should still add updated dependencies line for dependencies that have a bump type less than the minimum internal bump range but leave semver range" , async ( ) => {
1359+ let { changedFiles } = await testSetup (
1360+ "internal-dependencies" ,
1361+ {
1362+ changesets : [
1363+ {
1364+ id : "quick-lions-devour" ,
1365+ summary : "Hey, let's have fun with testing!" ,
1366+ releases : [
1367+ { name : "pkg-a" , type : "patch" } ,
1368+ { name : "pkg-b" , type : "patch" } ,
1369+ { name : "pkg-c" , type : "patch" }
1370+ ]
1371+ }
1372+ ] ,
1373+ releases : [
1374+ {
1375+ name : "pkg-a" ,
1376+ type : "patch" ,
1377+ oldVersion : "1.0.3" ,
1378+ newVersion : "1.0.4" ,
1379+ changesets : [ "quick-lions-devour" ]
1380+ } ,
1381+ {
1382+ name : "pkg-b" ,
1383+ type : "patch" ,
1384+ oldVersion : "1.2.0" ,
1385+ newVersion : "1.2.1" ,
1386+ changesets : [ "quick-lions-devour" ]
1387+ } ,
1388+ {
1389+ name : "pkg-c" ,
1390+ type : "patch" ,
1391+ oldVersion : "2.0.0" ,
1392+ newVersion : "2.0.1" ,
1393+ changesets : [ "quick-lions-devour" ]
1394+ }
1395+ ] ,
1396+ preState : undefined
1397+ } ,
1398+ {
1399+ changelog : [
1400+ path . resolve ( __dirname , "test-utils/simple-get-changelog-entry" ) ,
1401+ null
1402+ ] ,
1403+ commit : false ,
1404+ linked : [ ] ,
1405+ access : "restricted" ,
1406+ baseBranch : "master" ,
1407+ updateInternalDependencies : "minor"
1408+ }
1409+ ) ;
1410+
1411+ let readmePath = changedFiles . find ( a =>
1412+ a . endsWith ( `pkg-a${ path . sep } CHANGELOG.md` )
1413+ ) ;
1414+ let readmePathB = changedFiles . find ( a =>
1415+ a . endsWith ( `pkg-b${ path . sep } CHANGELOG.md` )
1416+ ) ;
1417+ let readmePathC = changedFiles . find ( a =>
1418+ a . endsWith ( `pkg-c${ path . sep } CHANGELOG.md` )
1419+ ) ;
1420+
1421+ if ( ! readmePath || ! readmePathB || ! readmePathC )
1422+ throw new Error ( `could not find an updated changelog` ) ;
1423+ let readme = await fs . readFile ( readmePath , "utf-8" ) ;
1424+ let readmeB = await fs . readFile ( readmePathB , "utf-8" ) ;
1425+ let readmeC = await fs . readFile ( readmePathC , "utf-8" ) ;
1426+
1427+ expect ( readme . trim ( ) ) . toEqual ( outdent `# pkg-a
1428+
1429+ ## 1.0.4
1430+ ### Patch Changes
1431+
1432+ - Hey, let's have fun with testing!` ) ;
1433+
1434+ expect ( readmeB . trim ( ) ) . toEqual ( outdent `# pkg-b
1435+
1436+ ## 1.2.1
1437+ ### Patch Changes
1438+
1439+ - Hey, let's have fun with testing!
1440+ - Updated dependencies [undefined]
1441+ 1442+
1443+ expect ( readmeC . trim ( ) ) . toEqual ( outdent `# pkg-c
1444+
1445+ ## 2.0.1
1446+ ### Patch Changes
1447+
1448+ - Hey, let's have fun with testing!` ) ;
1449+ } ) ;
12011450 } ) ;
12021451 describe ( "should error and not write if" , ( ) => {
12031452 // This is skipped as *for now* we are assuming we have been passed
0 commit comments