@@ -346,4 +346,147 @@ describe('LinkedVersions plugin', () => {
346346 expect ( groupPullRequest1 . headRefName ) . to . not . include ( ' ' ) ;
347347 expect ( groupPullRequest2 . headRefName ) . to . not . include ( ' ' ) ;
348348 } ) ;
349+
350+ it ( 'should use "libraries" in title by default for backward compatibility' , async ( ) => {
351+ const manifest = new Manifest (
352+ github ,
353+ 'target-branch' ,
354+ {
355+ 'path/a' : {
356+ releaseType : 'simple' ,
357+ component : 'pkg1' ,
358+ } ,
359+ 'path/b' : {
360+ releaseType : 'simple' ,
361+ component : 'pkg2' ,
362+ } ,
363+ 'path/c' : {
364+ releaseType : 'simple' ,
365+ component : 'pkg3' ,
366+ } ,
367+ } ,
368+ {
369+ 'path/a' : Version . parse ( '1.0.0' ) ,
370+ 'path/b' : Version . parse ( '0.2.3' ) ,
371+ 'path/c' : Version . parse ( '0.2.3' ) ,
372+ } ,
373+ {
374+ separatePullRequests : true ,
375+ plugins : [
376+ {
377+ type : 'linked-versions' ,
378+ groupName : 'my-group' ,
379+ components : [ 'pkg2' , 'pkg3' ] ,
380+ } ,
381+ ] ,
382+ }
383+ ) ;
384+ const pullRequests = await manifest . buildPullRequests ( ) ;
385+ expect ( pullRequests ) . lengthOf ( 2 ) ;
386+ const groupedPullRequest = pullRequests . find ( pr =>
387+ pr . title . toString ( ) . includes ( 'my-group' )
388+ ) ;
389+ expect ( groupedPullRequest ) . to . not . be . undefined ;
390+ expect ( groupedPullRequest ! . title . toString ( ) ) . to . include ( 'libraries' ) ;
391+ expect ( groupedPullRequest ! . title . toString ( ) ) . to . equal (
392+ 'chore(target-branch): release my-group libraries'
393+ ) ;
394+ } ) ;
395+
396+ it ( 'should respect groupPullRequestTitlePattern with version' , async ( ) => {
397+ const manifest = new Manifest (
398+ github ,
399+ 'target-branch' ,
400+ {
401+ 'path/a' : {
402+ releaseType : 'simple' ,
403+ component : 'pkg1' ,
404+ } ,
405+ 'path/b' : {
406+ releaseType : 'simple' ,
407+ component : 'pkg2' ,
408+ } ,
409+ 'path/c' : {
410+ releaseType : 'simple' ,
411+ component : 'pkg3' ,
412+ } ,
413+ } ,
414+ {
415+ 'path/a' : Version . parse ( '1.0.0' ) ,
416+ 'path/b' : Version . parse ( '0.2.3' ) ,
417+ 'path/c' : Version . parse ( '0.2.3' ) ,
418+ } ,
419+ {
420+ separatePullRequests : true ,
421+ groupPullRequestTitlePattern :
422+ 'chore${scope}: release ${component} ${version}' ,
423+ plugins : [
424+ {
425+ type : 'linked-versions' ,
426+ groupName : 'my-sdk' ,
427+ components : [ 'pkg2' , 'pkg3' ] ,
428+ } ,
429+ ] ,
430+ }
431+ ) ;
432+ const pullRequests = await manifest . buildPullRequests ( ) ;
433+ expect ( pullRequests ) . lengthOf ( 2 ) ;
434+ // Find the grouped PR (pkg2+pkg3) - it should have multiple release data entries
435+ const groupedPullRequest = pullRequests . find (
436+ pr => pr . body . releaseData . length > 1
437+ ) ;
438+ expect ( groupedPullRequest ) . to . not . be . undefined ;
439+ expect ( groupedPullRequest ! . title . toString ( ) ) . to . not . include ( 'libraries' ) ;
440+ expect ( groupedPullRequest ! . title . toString ( ) ) . to . include ( '0.2.4' ) ;
441+ expect ( groupedPullRequest ! . title . toString ( ) ) . to . equal (
442+ 'chore(target-branch): release my-sdk 0.2.4'
443+ ) ;
444+ } ) ;
445+
446+ it ( 'should respect custom groupPullRequestTitlePattern' , async ( ) => {
447+ const manifest = new Manifest (
448+ github ,
449+ 'target-branch' ,
450+ {
451+ 'path/a' : {
452+ releaseType : 'simple' ,
453+ component : 'pkg1' ,
454+ } ,
455+ 'path/b' : {
456+ releaseType : 'simple' ,
457+ component : 'pkg2' ,
458+ } ,
459+ 'path/c' : {
460+ releaseType : 'simple' ,
461+ component : 'pkg3' ,
462+ } ,
463+ } ,
464+ {
465+ 'path/a' : Version . parse ( '1.0.0' ) ,
466+ 'path/b' : Version . parse ( '0.2.3' ) ,
467+ 'path/c' : Version . parse ( '0.2.3' ) ,
468+ } ,
469+ {
470+ separatePullRequests : true ,
471+ groupPullRequestTitlePattern : 'feat${scope}: ${component} v${version}' ,
472+ plugins : [
473+ {
474+ type : 'linked-versions' ,
475+ groupName : 'core-libs' ,
476+ components : [ 'pkg2' , 'pkg3' ] ,
477+ } ,
478+ ] ,
479+ }
480+ ) ;
481+ const pullRequests = await manifest . buildPullRequests ( ) ;
482+ expect ( pullRequests ) . lengthOf ( 2 ) ;
483+ // Find the grouped PR (pkg2+pkg3) - it should have multiple release data entries
484+ const groupedPullRequest = pullRequests . find (
485+ pr => pr . body . releaseData . length > 1
486+ ) ;
487+ expect ( groupedPullRequest ) . to . not . be . undefined ;
488+ expect ( groupedPullRequest ! . title . toString ( ) ) . to . equal (
489+ 'feat(target-branch): core-libs v0.2.4'
490+ ) ;
491+ } ) ;
349492} ) ;
0 commit comments