@@ -263,5 +263,72 @@ describe('validate-commit-message.js', () => {
263
263
VALID ) ;
264
264
} ) ;
265
265
} ) ;
266
+
267
+ describe ( 'breaking change' , ( ) => {
268
+ it ( 'should allow valid breaking change commit descriptions' , ( ) => {
269
+ const msgWithSummary = 'feat(compiler): this is just an usual commit message tile\n\n' +
270
+ 'This is a normal commit message body which does not exceed the max length\n' +
271
+ 'limit. For more details see the following super long URL:\n\n' +
272
+ 'BREAKING CHANGE: This is a summary of a breaking change.' ;
273
+ expectValidationResult ( validateCommitMessage ( msgWithSummary ) , VALID ) ;
274
+
275
+ const msgWithDescription = 'feat(compiler): this is just an usual commit message tile\n\n' +
276
+ 'This is a normal commit message body which does not exceed the max length\n' +
277
+ 'limit. For more details see the following super long URL:\n\n' +
278
+ 'BREAKING CHANGE:\n\n' +
279
+ 'This is a full description of the breaking change.' ;
280
+ expectValidationResult ( validateCommitMessage ( msgWithDescription ) , VALID ) ;
281
+
282
+ const msgWithSummaryAndDescription =
283
+ 'feat(compiler): this is just an usual commit message tile\n\n' +
284
+ 'This is a normal commit message body which does not exceed the max length\n' +
285
+ 'limit. For more details see the following super long URL:\n\n' +
286
+ 'BREAKING CHANGE: This is a summary of a breaking change.\n\n' +
287
+ 'This is a full description of the breaking change.' ;
288
+ expectValidationResult ( validateCommitMessage ( msgWithSummaryAndDescription ) , VALID ) ;
289
+
290
+ const msgWithNonBreaking = 'feat(compiler): this is just an usual commit message tile\n\n' +
291
+ 'This is not a\n' +
292
+ 'breaking change commit.' ;
293
+ expectValidationResult ( validateCommitMessage ( msgWithNonBreaking ) , VALID ) ;
294
+ } ) ;
295
+
296
+ it ( 'should fail for non-valid breaking change commit descriptions' , ( ) => {
297
+ const msgWithSummary = 'feat(compiler): this is just an usual commit message tile\n\n' +
298
+ 'This is a normal commit message body which does not exceed the max length\n' +
299
+ 'limit. For more details see the following super long URL:\n\n' +
300
+ 'BREAKING CHANGE This is a summary of a breaking change.' ;
301
+ expectValidationResult (
302
+ validateCommitMessage ( msgWithSummary ) , INVALID ,
303
+ [ `The commit message body contains an invalid breaking change description.` ] ) ;
304
+
305
+ const msgWithPlural = 'feat(compiler): this is just an usual commit message tile\n\n' +
306
+ 'This is a normal commit message body which does not exceed the max length\n' +
307
+ 'limit. For more details see the following super long URL:\n\n' +
308
+ 'BREAKING CHANGES: This is a summary of a breaking change.' ;
309
+ expectValidationResult (
310
+ validateCommitMessage ( msgWithPlural ) , INVALID ,
311
+ [ `The commit message body contains an invalid breaking change description.` ] ) ;
312
+
313
+ const msgWithDescription = 'feat(compiler): this is just an usual commit message tile\n\n' +
314
+ 'This is a normal commit message body which does not exceed the max length\n' +
315
+ 'limit. For more details see the following super long URL:\n\n' +
316
+ 'BREAKING CHANGE:\n' +
317
+ 'This is a full description of the breaking change.' ;
318
+ expectValidationResult (
319
+ validateCommitMessage ( msgWithDescription ) , INVALID ,
320
+ [ `The commit message body contains an invalid breaking change description.` ] ) ;
321
+
322
+ const msgWithSummaryAndDescription =
323
+ 'feat(compiler): this is just an usual commit message tile\n\n' +
324
+ 'This is a normal commit message body which does not exceed the max length\n' +
325
+ 'limit. For more details see the following super long URL:\n\n' +
326
+ 'BREAKING CHANGE\n\n' +
327
+ 'This is a full description of the breaking change.' ;
328
+ expectValidationResult (
329
+ validateCommitMessage ( msgWithSummaryAndDescription ) , INVALID ,
330
+ [ `The commit message body contains an invalid breaking change description.` ] ) ;
331
+ } ) ;
332
+ } ) ;
266
333
} ) ;
267
334
} ) ;
0 commit comments