File tree Expand file tree Collapse file tree 3 files changed +25
-2
lines changed Expand file tree Collapse file tree 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) {
8383 'What is the scope of this change (e.g. component or file name): (press enter to skip)' ,
8484 default : options . defaultScope ,
8585 filter : function ( value ) {
86- return value . trim ( ) . toLowerCase ( ) ;
86+ return options . disableScopeLowerCase
87+ ? value . trim ( )
88+ : value . trim ( ) . toLowerCase ( ) ;
8789 }
8890 } ,
8991 {
Original file line number Diff line number Diff line change @@ -18,7 +18,6 @@ var defaultOptions = {
1818var type = 'func' ;
1919var scope = 'everything' ;
2020var subject = 'testing123' ;
21- var subject2 = 'after the fall, I was gone' ;
2221var longBody =
2322 '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' +
2423 '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() {
8584 } )
8685 ) . to . equal ( `${ type } (${ scope } ): ${ subject } \n\n${ body } ` ) ;
8786 } ) ;
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+ } ) ;
88104 it ( 'header, body and issues w/ out scope' , function ( ) {
89105 expect (
90106 commitMessage ( {
@@ -298,6 +314,9 @@ describe('defaults', function() {
298314 )
299315 ) . to . equal ( issues ) ;
300316 } ) ;
317+ it ( 'disableScopeLowerCase default' , function ( ) {
318+ expect ( questionDefault ( 'disableScopeLowerCase' ) ) . to . be . undefined ;
319+ } ) ;
301320} ) ;
302321
303322describe ( 'prompts' , function ( ) {
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ var options = {
1212 defaultSubject : process . env . CZ_SUBJECT || config . defaultSubject ,
1313 defaultBody : process . env . CZ_BODY || config . defaultBody ,
1414 defaultIssues : process . env . CZ_ISSUES || config . defaultIssues ,
15+ disableScopeLowerCase :
16+ process . env . DISABLE_SCOPE_LOWERCASE || config . disableScopeLowerCase ,
1517 maxHeaderWidth :
1618 ( process . env . CZ_MAX_HEADER_WIDTH &&
1719 parseInt ( process . env . CZ_MAX_HEADER_WIDTH ) ) ||
You can’t perform that action at this time.
0 commit comments