@@ -575,21 +575,26 @@ describe('create-release-branch (functional)', () => {
575
575
} ,
576
576
} ) ;
577
577
578
- // Tests four things:
579
- // * The latest commit should be called "Release 1.0.0"
578
+ // Tests five things:
579
+ // * The latest commit should be called "Update Release 2.0.0"
580
+ // * The before latest commit should be called "Initialize Release 2.0.0"
580
581
// * The latest commit should be the current commit (HEAD)
581
- // * The latest branch should be called "release/1 .0.0"
582
+ // * The latest branch should be called "release/2 .0.0"
582
583
// * The latest branch should point to the latest commit
583
- const [ latestCommitSubject , latestCommitId , latestCommitRevsMarker ] =
584
- (
585
- await environment . runCommand ( 'git' , [
586
- 'log' ,
587
- '--pretty=%s%x09%H%x09%D' ,
588
- '--date-order' ,
589
- '--max-count=1' ,
590
- ] )
591
- ) . stdout . split ( '\x09' ) ;
592
- const latestCommitRevs = latestCommitRevsMarker . split ( ' -> ' ) ;
584
+ const latestCommitsInReverse = (
585
+ await environment . runCommand ( 'git' , [
586
+ 'log' ,
587
+ '--pretty=%s%x09%H%x09%D' ,
588
+ '--date-order' ,
589
+ '--max-count=2' ,
590
+ ] )
591
+ ) . stdout
592
+ . split ( '\n' )
593
+ . map ( ( line ) => {
594
+ const [ subject , commitId , revsMarker ] = line . split ( '\x09' ) ;
595
+ const revs = revsMarker . split ( ' -> ' ) ;
596
+ return { subject, commitId, revs } ;
597
+ } ) ;
593
598
const latestBranchCommitId = (
594
599
await environment . runCommand ( 'git' , [
595
600
'rev-list' ,
@@ -598,10 +603,19 @@ describe('create-release-branch (functional)', () => {
598
603
'--max-count=1' ,
599
604
] )
600
605
) . stdout ;
601
- expect ( latestCommitSubject ) . toBe ( 'Release 2.0.0' ) ;
602
- expect ( latestCommitRevs ) . toContain ( 'HEAD' ) ;
603
- expect ( latestCommitRevs ) . toContain ( 'release/2.0.0' ) ;
604
- expect ( latestBranchCommitId ) . toStrictEqual ( latestCommitId ) ;
606
+ expect ( latestCommitsInReverse [ 0 ] . subject ) . toBe (
607
+ 'Update Release 2.0.0' ,
608
+ ) ;
609
+ expect ( latestCommitsInReverse [ 1 ] . subject ) . toBe (
610
+ 'Initialize Release 2.0.0' ,
611
+ ) ;
612
+
613
+ expect ( latestCommitsInReverse [ 0 ] . revs ) . toContain ( 'HEAD' ) ;
614
+ expect ( latestCommitsInReverse [ 0 ] . revs ) . toContain ( 'release/2.0.0' ) ;
615
+
616
+ expect ( latestBranchCommitId ) . toStrictEqual (
617
+ latestCommitsInReverse [ 0 ] . commitId ,
618
+ ) ;
605
619
} ,
606
620
) ;
607
621
} ) ;
0 commit comments