@@ -11,6 +11,10 @@ var expect = chai.expect;
11
11
chai . should ( ) ;
12
12
13
13
var defaultOptions = defaults ;
14
+ const skipTypeOptions = {
15
+ ...defaultOptions ,
16
+ skipType : true
17
+ } ;
14
18
15
19
var type = 'func' ;
16
20
var scope = 'everything' ;
@@ -49,7 +53,18 @@ var longIssuesSplit =
49
53
longIssues . slice ( defaultOptions . maxLineWidth * 2 , longIssues . length ) . trim ( ) ;
50
54
51
55
describe ( 'commit message' , function ( ) {
52
- it ( 'only header w/ out scope' , function ( ) {
56
+ it ( 'only header w/ out scope and w/ out type' , function ( ) {
57
+ expect (
58
+ commitMessage (
59
+ {
60
+ jira,
61
+ subject
62
+ } ,
63
+ skipTypeOptions
64
+ )
65
+ ) . to . equal ( `${ jiraUpperCase } ${ subject } ` ) ;
66
+ } ) ;
67
+ it ( 'only header w/ out scope and w/ type' , function ( ) {
53
68
expect (
54
69
commitMessage ( {
55
70
type,
@@ -58,7 +73,7 @@ describe('commit message', function() {
58
73
} )
59
74
) . to . equal ( `${ type } : ${ jiraUpperCase } ${ subject } ` ) ;
60
75
} ) ;
61
- it ( 'only header w/ scope' , function ( ) {
76
+ it ( 'only header w/ scope and w/ type ' , function ( ) {
62
77
expect (
63
78
commitMessage ( {
64
79
type,
@@ -68,7 +83,19 @@ describe('commit message', function() {
68
83
} )
69
84
) . to . equal ( `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } ` ) ;
70
85
} ) ;
71
- it ( 'header and body w/ out scope' , function ( ) {
86
+ it ( 'only header w/ scope and w/ out type' , function ( ) {
87
+ expect (
88
+ commitMessage (
89
+ {
90
+ scope,
91
+ jira,
92
+ subject
93
+ } ,
94
+ skipTypeOptions
95
+ )
96
+ ) . to . equal ( `(${ scope } ): ${ jiraUpperCase } ${ subject } ` ) ;
97
+ } ) ;
98
+ it ( 'header and body w/ out scope and w/ type' , function ( ) {
72
99
expect (
73
100
commitMessage ( {
74
101
type,
@@ -78,7 +105,19 @@ describe('commit message', function() {
78
105
} )
79
106
) . to . equal ( `${ type } : ${ jiraUpperCase } ${ subject } \n\n${ body } ` ) ;
80
107
} ) ;
81
- it ( 'header and body w/ scope' , function ( ) {
108
+ it ( 'header and body w/ out scope and w/ out type' , function ( ) {
109
+ expect (
110
+ commitMessage (
111
+ {
112
+ jira,
113
+ subject,
114
+ body
115
+ } ,
116
+ skipTypeOptions
117
+ )
118
+ ) . to . equal ( `${ jiraUpperCase } ${ subject } \n\n${ body } ` ) ;
119
+ } ) ;
120
+ it ( 'header and body w/ scope and w/ type' , function ( ) {
82
121
expect (
83
122
commitMessage ( {
84
123
type,
@@ -89,6 +128,19 @@ describe('commit message', function() {
89
128
} )
90
129
) . to . equal ( `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } ` ) ;
91
130
} ) ;
131
+ it ( 'header and body w/ scope and w/ out type' , function ( ) {
132
+ expect (
133
+ commitMessage (
134
+ {
135
+ scope,
136
+ jira,
137
+ subject,
138
+ body
139
+ } ,
140
+ skipTypeOptions
141
+ )
142
+ ) . to . equal ( `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } ` ) ;
143
+ } ) ;
92
144
it ( 'header and body w/ custom scope' , function ( ) {
93
145
expect (
94
146
commitMessage ( {
@@ -99,9 +151,24 @@ describe('commit message', function() {
99
151
subject,
100
152
body
101
153
} )
102
- ) . to . equal ( `${ type } (${ customScope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } ` ) ;
154
+ ) . to . equal (
155
+ `${ type } (${ customScope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } `
156
+ ) ;
157
+ } ) ;
158
+ it ( 'header, body and issues w/ out scope and w/ out type' , function ( ) {
159
+ expect (
160
+ commitMessage (
161
+ {
162
+ jira,
163
+ subject,
164
+ body,
165
+ issues
166
+ } ,
167
+ skipTypeOptions
168
+ )
169
+ ) . to . equal ( `${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ issues } ` ) ;
103
170
} ) ;
104
- it ( 'header, body and issues w/ out scope' , function ( ) {
171
+ it ( 'header, body and issues w/ out scope and w/ type ' , function ( ) {
105
172
expect (
106
173
commitMessage ( {
107
174
type,
@@ -112,7 +179,23 @@ describe('commit message', function() {
112
179
} )
113
180
) . to . equal ( `${ type } : ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ issues } ` ) ;
114
181
} ) ;
115
- it ( 'header, body and issues w/ scope' , function ( ) {
182
+ it ( 'header, body and issues w/ scope and w/ out type' , function ( ) {
183
+ expect (
184
+ commitMessage (
185
+ {
186
+ scope,
187
+ jira,
188
+ subject,
189
+ body,
190
+ issues
191
+ } ,
192
+ skipTypeOptions
193
+ )
194
+ ) . to . equal (
195
+ `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ issues } `
196
+ ) ;
197
+ } ) ;
198
+ it ( 'header, body and issues w/ scope and w/ type' , function ( ) {
116
199
expect (
117
200
commitMessage ( {
118
201
type,
@@ -122,9 +205,24 @@ describe('commit message', function() {
122
205
body,
123
206
issues
124
207
} )
125
- ) . to . equal ( `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ issues } ` ) ;
208
+ ) . to . equal (
209
+ `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ issues } `
210
+ ) ;
211
+ } ) ;
212
+ it ( 'header, body and long issues w/ out scope and w/ out type' , function ( ) {
213
+ expect (
214
+ commitMessage (
215
+ {
216
+ jira,
217
+ subject,
218
+ body,
219
+ issues : longIssues
220
+ } ,
221
+ skipTypeOptions
222
+ )
223
+ ) . to . equal ( `${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ longIssuesSplit } ` ) ;
126
224
} ) ;
127
- it ( 'header, body and long issues w/ out scope' , function ( ) {
225
+ it ( 'header, body and long issues w/ out scope and w/ type ' , function ( ) {
128
226
expect (
129
227
commitMessage ( {
130
228
type,
@@ -133,9 +231,27 @@ describe('commit message', function() {
133
231
body,
134
232
issues : longIssues
135
233
} )
136
- ) . to . equal ( `${ type } : ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ longIssuesSplit } ` ) ;
234
+ ) . to . equal (
235
+ `${ type } : ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ longIssuesSplit } `
236
+ ) ;
237
+ } ) ;
238
+ it ( 'header, body and long issues w/ scope and w/ out type' , function ( ) {
239
+ expect (
240
+ commitMessage (
241
+ {
242
+ scope,
243
+ jira,
244
+ subject,
245
+ body,
246
+ issues : longIssues
247
+ } ,
248
+ skipTypeOptions
249
+ )
250
+ ) . to . equal (
251
+ `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ longIssuesSplit } `
252
+ ) ;
137
253
} ) ;
138
- it ( 'header, body and long issues w/ scope' , function ( ) {
254
+ it ( 'header, body and long issues w/ scope and w/ tyoe ' , function ( ) {
139
255
expect (
140
256
commitMessage ( {
141
257
type,
@@ -149,7 +265,19 @@ describe('commit message', function() {
149
265
`${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ longIssuesSplit } `
150
266
) ;
151
267
} ) ;
152
- it ( 'header and long body w/ out scope' , function ( ) {
268
+ it ( 'header and long body w/ out scope and w/ out type' , function ( ) {
269
+ expect (
270
+ commitMessage (
271
+ {
272
+ jira,
273
+ subject,
274
+ body : longBody
275
+ } ,
276
+ skipTypeOptions
277
+ )
278
+ ) . to . equal ( `${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } ` ) ;
279
+ } ) ;
280
+ it ( 'header and long body w/ out scope and w/ type' , function ( ) {
153
281
expect (
154
282
commitMessage ( {
155
283
type,
@@ -159,7 +287,20 @@ describe('commit message', function() {
159
287
} )
160
288
) . to . equal ( `${ type } : ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } ` ) ;
161
289
} ) ;
162
- it ( 'header and long body w/ scope' , function ( ) {
290
+ it ( 'header and long body w/ scope and w/ out type' , function ( ) {
291
+ expect (
292
+ commitMessage (
293
+ {
294
+ scope,
295
+ jira,
296
+ subject,
297
+ body : longBody
298
+ } ,
299
+ skipTypeOptions
300
+ )
301
+ ) . to . equal ( `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } ` ) ;
302
+ } ) ;
303
+ it ( 'header and long body w/ scope and w/ type' , function ( ) {
163
304
expect (
164
305
commitMessage ( {
165
306
type,
@@ -168,9 +309,24 @@ describe('commit message', function() {
168
309
subject,
169
310
body : longBody
170
311
} )
171
- ) . to . equal ( `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } ` ) ;
312
+ ) . to . equal (
313
+ `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } `
314
+ ) ;
315
+ } ) ;
316
+ it ( 'header, long body and issues w/ out scope and w/ out type' , function ( ) {
317
+ expect (
318
+ commitMessage (
319
+ {
320
+ jira,
321
+ subject,
322
+ body : longBody ,
323
+ issues
324
+ } ,
325
+ skipTypeOptions
326
+ )
327
+ ) . to . equal ( `${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ issues } ` ) ;
172
328
} ) ;
173
- it ( 'header, long body and issues w/ out scope' , function ( ) {
329
+ it ( 'header, long body and issues w/ out scope and w/ type ' , function ( ) {
174
330
expect (
175
331
commitMessage ( {
176
332
type,
@@ -179,9 +335,27 @@ describe('commit message', function() {
179
335
body : longBody ,
180
336
issues
181
337
} )
182
- ) . to . equal ( `${ type } : ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ issues } ` ) ;
338
+ ) . to . equal (
339
+ `${ type } : ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ issues } `
340
+ ) ;
183
341
} ) ;
184
- it ( 'header, long body and issues w/ scope' , function ( ) {
342
+ it ( 'header, long body and issues w/ scope and w/ out type' , function ( ) {
343
+ expect (
344
+ commitMessage (
345
+ {
346
+ scope,
347
+ jira,
348
+ subject,
349
+ body : longBody ,
350
+ issues
351
+ } ,
352
+ skipTypeOptions
353
+ )
354
+ ) . to . equal (
355
+ `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ issues } `
356
+ ) ;
357
+ } ) ;
358
+ it ( 'header, long body and issues w/ scope and w/ type' , function ( ) {
185
359
expect (
186
360
commitMessage ( {
187
361
type,
@@ -195,7 +369,22 @@ describe('commit message', function() {
195
369
`${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ issues } `
196
370
) ;
197
371
} ) ;
198
- it ( 'header, long body and long issues w/ out scope' , function ( ) {
372
+ it ( 'header, long body and long issues w/ out scope and w/ out type' , function ( ) {
373
+ expect (
374
+ commitMessage (
375
+ {
376
+ jira,
377
+ subject,
378
+ body : longBody ,
379
+ issues : longIssues
380
+ } ,
381
+ skipTypeOptions
382
+ )
383
+ ) . to . equal (
384
+ `${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ longIssuesSplit } `
385
+ ) ;
386
+ } ) ;
387
+ it ( 'header, long body and long issues w/ out scope and w/ type' , function ( ) {
199
388
expect (
200
389
commitMessage ( {
201
390
type,
@@ -208,7 +397,23 @@ describe('commit message', function() {
208
397
`${ type } : ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ longIssuesSplit } `
209
398
) ;
210
399
} ) ;
211
- it ( 'header, long body and long issues w/ scope' , function ( ) {
400
+ it ( 'header, long body and long issues w/ scope and w/ out type' , function ( ) {
401
+ expect (
402
+ commitMessage (
403
+ {
404
+ scope,
405
+ jira,
406
+ subject,
407
+ body : longBody ,
408
+ issues : longIssues
409
+ } ,
410
+ skipTypeOptions
411
+ )
412
+ ) . to . equal (
413
+ `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ longIssuesSplit } `
414
+ ) ;
415
+ } ) ;
416
+ it ( 'header, long body and long issues w/ scope and w/ type' , function ( ) {
212
417
expect (
213
418
commitMessage ( {
214
419
type,
@@ -225,7 +430,6 @@ describe('commit message', function() {
225
430
it ( 'header, long body, breaking change, and long issues w/ scope' , function ( ) {
226
431
expect (
227
432
commitMessage ( {
228
- type,
229
433
scope,
230
434
jira,
231
435
subject,
@@ -234,51 +438,120 @@ describe('commit message', function() {
234
438
issues : longIssues
235
439
} )
236
440
) . to . equal (
237
- `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ breakingChange } ${ breaking } \n\n${ longIssuesSplit } `
441
+ `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ breakingChange } ${ breaking } \n\n${ longIssuesSplit } `
238
442
) ;
239
443
} ) ;
240
- it ( 'header, long body, breaking change (with prefix entered) , and long issues w/ scope' , function ( ) {
444
+ it ( 'header, long body, breaking change, and long issues w/ scope and w/ type ' , function ( ) {
241
445
expect (
242
446
commitMessage ( {
243
447
type,
244
448
scope,
245
449
jira,
246
450
subject,
247
451
body : longBody ,
248
- breaking : ` ${ breakingChange } ${ breaking } ` ,
452
+ breaking,
249
453
issues : longIssues
250
454
} )
251
455
) . to . equal (
252
456
`${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ breakingChange } ${ breaking } \n\n${ longIssuesSplit } `
253
457
) ;
254
458
} ) ;
255
- it ( 'header, body, breaking change, and issues w/ scope; exclamation mark enabled' , function ( ) {
459
+ it ( 'header, long body, breaking change (with prefix entered), and long issues w/ scope and w/ out type' , function ( ) {
460
+ expect (
461
+ commitMessage (
462
+ {
463
+ scope,
464
+ jira,
465
+ subject,
466
+ body : longBody ,
467
+ breaking : `${ breakingChange } ${ breaking } ` ,
468
+ issues : longIssues
469
+ } ,
470
+ skipTypeOptions
471
+ )
472
+ ) . to . equal (
473
+ `(${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ breakingChange } ${ breaking } \n\n${ longIssuesSplit } `
474
+ ) ;
475
+ } ) ;
476
+ it ( 'header, long body, breaking change (with prefix entered), and long issues w/ scope and w/ type' , function ( ) {
256
477
expect (
257
478
commitMessage ( {
258
479
type,
259
480
scope,
260
481
jira,
261
482
subject,
262
- body,
263
- breaking,
264
- issues
265
- } ,
266
- { ...defaultOptions , exclamationMark : true } )
483
+ body : longBody ,
484
+ breaking : `${ breakingChange } ${ breaking } ` ,
485
+ issues : longIssues
486
+ } )
487
+ ) . to . equal (
488
+ `${ type } (${ scope } ): ${ jiraUpperCase } ${ subject } \n\n${ longBodySplit } \n\n${ breakingChange } ${ breaking } \n\n${ longIssuesSplit } `
489
+ ) ;
490
+ } ) ;
491
+ it ( 'header, body, breaking change, and issues w/ scope and w/o type; exclamation mark enabled' , function ( ) {
492
+ expect (
493
+ commitMessage (
494
+ {
495
+ scope,
496
+ jira,
497
+ subject,
498
+ body,
499
+ breaking,
500
+ issues
501
+ } ,
502
+ { ...skipTypeOptions , exclamationMark : true }
503
+ )
504
+ ) . to . equal (
505
+ `(${ scope } )!: ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ breakingChange } ${ breaking } \n\n${ issues } `
506
+ ) ;
507
+ } ) ;
508
+ it ( 'header, body, breaking change, and issues w/ scope and w/ type; exclamation mark enabled' , function ( ) {
509
+ expect (
510
+ commitMessage (
511
+ {
512
+ type,
513
+ scope,
514
+ jira,
515
+ subject,
516
+ body,
517
+ breaking,
518
+ issues
519
+ } ,
520
+ { ...defaultOptions , exclamationMark : true }
521
+ )
267
522
) . to . equal (
268
523
`${ type } (${ scope } )!: ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ breakingChange } ${ breaking } \n\n${ issues } `
269
524
) ;
270
525
} ) ;
271
- it ( 'header, body, breaking change, and issues w/o scope; exclamation mark enabled' , function ( ) {
526
+ it ( 'header, body, breaking change, and issues w/o scope and w/o type ; exclamation mark enabled' , function ( ) {
272
527
expect (
273
- commitMessage ( {
274
- type,
275
- jira,
276
- subject,
277
- body,
278
- breaking,
279
- issues
280
- } ,
281
- { ...defaultOptions , exclamationMark : true } )
528
+ commitMessage (
529
+ {
530
+ jira,
531
+ subject,
532
+ body,
533
+ breaking,
534
+ issues
535
+ } ,
536
+ { ...skipTypeOptions , exclamationMark : true }
537
+ )
538
+ ) . to . equal (
539
+ `!: ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ breakingChange } ${ breaking } \n\n${ issues } `
540
+ ) ;
541
+ } ) ;
542
+ it ( 'header, body, breaking change, and issues w/o scope and w/ type; exclamation mark enabled' , function ( ) {
543
+ expect (
544
+ commitMessage (
545
+ {
546
+ type,
547
+ jira,
548
+ subject,
549
+ body,
550
+ breaking,
551
+ issues
552
+ } ,
553
+ { ...defaultOptions , exclamationMark : true }
554
+ )
282
555
) . to . equal (
283
556
`${ type } !: ${ jiraUpperCase } ${ subject } \n\n${ body } \n\n${ breakingChange } ${ breaking } \n\n${ issues } `
284
557
) ;
0 commit comments