@@ -374,6 +374,76 @@ describe('version bumping', () => {
374374 expect ( changeFiles ) . toHaveLength ( 0 ) ;
375375 } ) ;
376376
377+ it ( 'should not bump local package dependencies' , async ( ) => {
378+ const monorepo : RepoFixture [ 'folders' ] = {
379+ packages : {
380+ 'pkg-1' : {
381+ version : '1.0.0' ,
382+ dependencies : { 'pkg-2' : 'file:../pkg-2' } ,
383+ devDependencies : { 'pkg-3' : 'file:../pkg-3' } ,
384+ peerDependencies : { 'pkg-4' : 'file:../pkg-4' } ,
385+ optionalDependencies : { 'pkg-5' : 'file:../pkg-5' } ,
386+ } ,
387+ 'pkg-2' : { version : '1.0.0' } ,
388+ 'pkg-3' : { version : '1.0.0' } ,
389+ 'pkg-4' : { version : '1.0.0' } ,
390+ 'pkg-5' : { version : '1.0.0' } ,
391+ } ,
392+ } ;
393+ repositoryFactory = new RepositoryFactory ( { folders : monorepo } ) ;
394+ repo = repositoryFactory . cloneRepository ( ) ;
395+
396+ const { originalPackageInfos, options, parsedOptions } = getOptionsAndPackages ( {
397+ bumpDeps : true ,
398+ generateChangelog : true ,
399+ } ) ;
400+ generateChangeFiles ( [ { packageName : 'pkg-1' , type : 'minor' } ] , options ) ;
401+
402+ repo . push ( ) ;
403+
404+ await bump ( options , originalPackageInfos ) ;
405+
406+ const packageInfos = getPackageInfos ( parsedOptions ) ;
407+
408+ const pkg1NewVersion = '1.1.0' ;
409+ expect ( packageInfos [ 'pkg-1' ] . version ) . toBe ( pkg1NewVersion ) ;
410+ expect ( packageInfos [ 'pkg-2' ] . version ) . toBe ( monorepo [ 'packages' ] [ 'pkg-2' ] . version ) ;
411+ expect ( packageInfos [ 'pkg-3' ] . version ) . toBe ( monorepo [ 'packages' ] [ 'pkg-3' ] . version ) ;
412+ expect ( packageInfos [ 'pkg-4' ] . version ) . toBe ( monorepo [ 'packages' ] [ 'pkg-4' ] . version ) ;
413+ expect ( packageInfos [ 'pkg-5' ] . version ) . toBe ( monorepo [ 'packages' ] [ 'pkg-5' ] . version ) ;
414+
415+ expect ( packageInfos [ 'pkg-1' ] . dependencies ! [ 'pkg-2' ] ) . toBe ( monorepo [ 'packages' ] [ 'pkg-1' ] . dependencies ! [ 'pkg-2' ] ) ;
416+ expect ( packageInfos [ 'pkg-1' ] . devDependencies ! [ 'pkg-3' ] ) . toBe (
417+ monorepo [ 'packages' ] [ 'pkg-1' ] . devDependencies ! [ 'pkg-3' ]
418+ ) ;
419+ expect ( packageInfos [ 'pkg-1' ] . peerDependencies ! [ 'pkg-4' ] ) . toBe (
420+ monorepo [ 'packages' ] [ 'pkg-1' ] . peerDependencies ! [ 'pkg-4' ]
421+ ) ;
422+ expect ( packageInfos [ 'pkg-1' ] . optionalDependencies ! [ 'pkg-5' ] ) . toBe (
423+ monorepo [ 'packages' ] [ 'pkg-1' ] . optionalDependencies ! [ 'pkg-5' ]
424+ ) ;
425+
426+ const changeFiles = getChangeFiles ( options ) ;
427+ expect ( changeFiles ) . toHaveLength ( 0 ) ;
428+
429+ // Verify changelog doesn't include entries for file: dependencies
430+ const changelogJson = readChangelogJson ( repo . pathTo ( 'packages/pkg-1' ) ) ;
431+ expect ( changelogJson ?. entries ) . toHaveLength ( 1 ) ;
432+ const changelogComments = changelogJson ?. entries [ 0 ] . comments ;
433+ const allComments = [
434+ ...( changelogComments ?. major || [ ] ) ,
435+ ...( changelogComments ?. minor || [ ] ) ,
436+ ...( changelogComments ?. patch || [ ] ) ,
437+ ...( changelogComments ?. none || [ ] ) ,
438+ ] ;
439+ // Changelog should not mention pkg-2, pkg-3, pkg-4, or pkg-5 since they use file: protocol
440+ const commentTexts = allComments . map ( c => c . comment ) . join ( ' ' ) ;
441+ expect ( commentTexts ) . not . toContain ( 'pkg-2' ) ;
442+ expect ( commentTexts ) . not . toContain ( 'pkg-3' ) ;
443+ expect ( commentTexts ) . not . toContain ( 'pkg-4' ) ;
444+ expect ( commentTexts ) . not . toContain ( 'pkg-5' ) ;
445+ } ) ;
446+
377447 it ( 'bumps all packages and keeps change files with `keep-change-files` flag' , async ( ) => {
378448 const monorepo : RepoFixture [ 'folders' ] = {
379449 packages : {
0 commit comments