File tree 3 files changed +25
-2
lines changed
3 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,9 @@ module.exports = function(options) {
83
83
'What is the scope of this change (e.g. component or file name): (press enter to skip)' ,
84
84
default : options . defaultScope ,
85
85
filter : function ( value ) {
86
- return value . trim ( ) . toLowerCase ( ) ;
86
+ return options . disableScopeLowerCase
87
+ ? value . trim ( )
88
+ : value . trim ( ) . toLowerCase ( ) ;
87
89
}
88
90
} ,
89
91
{
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ var defaultOptions = {
18
18
var type = 'func' ;
19
19
var scope = 'everything' ;
20
20
var subject = 'testing123' ;
21
- var subject2 = 'after the fall, I was gone' ;
22
21
var longBody =
23
22
'a a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a' +
24
23
'a a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a aa a' +
@@ -85,6 +84,23 @@ describe('commit message', function() {
85
84
} )
86
85
) . to . equal ( `${ type } (${ scope } ): ${ subject } \n\n${ body } ` ) ;
87
86
} ) ;
87
+ it ( 'header and body w/ uppercase scope' , function ( ) {
88
+ var upperCaseScope = scope . toLocaleUpperCase ( ) ;
89
+ expect (
90
+ commitMessage (
91
+ {
92
+ type,
93
+ scope : upperCaseScope ,
94
+ subject,
95
+ body
96
+ } ,
97
+ {
98
+ ...defaultOptions ,
99
+ disableScopeLowerCase : true
100
+ }
101
+ )
102
+ ) . to . equal ( `${ type } (${ upperCaseScope } ): ${ subject } \n\n${ body } ` ) ;
103
+ } ) ;
88
104
it ( 'header, body and issues w/ out scope' , function ( ) {
89
105
expect (
90
106
commitMessage ( {
@@ -298,6 +314,9 @@ describe('defaults', function() {
298
314
)
299
315
) . to . equal ( issues ) ;
300
316
} ) ;
317
+ it ( 'disableScopeLowerCase default' , function ( ) {
318
+ expect ( questionDefault ( 'disableScopeLowerCase' ) ) . to . be . undefined ;
319
+ } ) ;
301
320
} ) ;
302
321
303
322
describe ( 'prompts' , function ( ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ var options = {
12
12
defaultSubject : process . env . CZ_SUBJECT || config . defaultSubject ,
13
13
defaultBody : process . env . CZ_BODY || config . defaultBody ,
14
14
defaultIssues : process . env . CZ_ISSUES || config . defaultIssues ,
15
+ disableScopeLowerCase :
16
+ process . env . DISABLE_SCOPE_LOWERCASE || config . disableScopeLowerCase ,
15
17
maxHeaderWidth :
16
18
( process . env . CZ_MAX_HEADER_WIDTH &&
17
19
parseInt ( process . env . CZ_MAX_HEADER_WIDTH ) ) ||
You can’t perform that action at this time.
0 commit comments