@@ -97,6 +97,55 @@ describe('getNextVersionFromCommitMessages', () => {
9797 expect ( actual ) . toBe ( '1.0.0' ) ;
9898 } ) ;
9999
100+ it ( 'detects major from BREAKING-CHANGE with hyphen' , ( ) => {
101+ const version = '1.2.3' ;
102+ const titles = 'feat: abc' ;
103+ const bodies = 'BREAKING-CHANGE: this also breaks things.' ;
104+ const { version : actual } = getNextVersionFromCommitMessages (
105+ version ,
106+ titles ,
107+ bodies
108+ ) ;
109+ expect ( actual ) . toBe ( '2.0.0' ) ;
110+ } ) ;
111+
112+ it ( 'does not trigger major from prose mentioning breaking changes' , ( ) => {
113+ const version = '1.2.3' ;
114+ const titles = 'feat: upgrade storybook' ;
115+ const bodies =
116+ 'This PR includes breaking changes around package consolidation.' ;
117+ const { version : actual } = getNextVersionFromCommitMessages (
118+ version ,
119+ titles ,
120+ bodies
121+ ) ;
122+ expect ( actual ) . toBe ( '1.3.0' ) ;
123+ } ) ;
124+
125+ it ( 'detects major from ! suffix in title' , ( ) => {
126+ const version = '1.2.3' ;
127+ const titles = 'feat!: remove deprecated API' ;
128+ const bodies = '' ;
129+ const { version : actual } = getNextVersionFromCommitMessages (
130+ version ,
131+ titles ,
132+ bodies
133+ ) ;
134+ expect ( actual ) . toBe ( '2.0.0' ) ;
135+ } ) ;
136+
137+ it ( 'detects major from scoped ! suffix in title' , ( ) => {
138+ const version = '1.2.3' ;
139+ const titles = 'fix(auth)!: change token format' ;
140+ const bodies = '' ;
141+ const { version : actual } = getNextVersionFromCommitMessages (
142+ version ,
143+ titles ,
144+ bodies
145+ ) ;
146+ expect ( actual ) . toBe ( '2.0.0' ) ;
147+ } ) ;
148+
100149 it ( 'gets a null with no commit messages' , ( ) => {
101150 const version = '0.0.1' ;
102151 const titles = '' ;
0 commit comments