@@ -133,6 +133,56 @@ describe('commit', function() {
133
133
} ) ;
134
134
135
135
} ) ;
136
+
137
+ it ( 'should allow to override options passed to gulp-git' , function ( done ) {
138
+
139
+ this . timeout ( config . maxTimeout ) ; // this could take a while
140
+
141
+ // SETUP
142
+
143
+ let dummyCommitMessage = `sip sip sippin on some sizzurp` ;
144
+ let author = `A U Thor <[email protected] >` ;
145
+
146
+ // Describe a repo and some files to add and commit
147
+ let repoConfig = {
148
+ path : config . paths . endUserRepo ,
149
+ files : {
150
+ dummyfile : {
151
+ contents : `duck-duck-goose` ,
152
+ filename : `mydummyfile.txt` ,
153
+ } ,
154
+ gitignore : {
155
+ contents : `node_modules/` ,
156
+ filename : `.gitignore`
157
+ }
158
+ }
159
+ } ;
160
+
161
+ // Describe an adapter
162
+ let adapterConfig = {
163
+ path : path . join ( repoConfig . path , '/node_modules/cz-jira-smart-commit' ) ,
164
+ npmName : 'cz-jira-smart-commit'
165
+ } ;
166
+
167
+ let options = {
168
+ args : `--author="${ author } " --no-edit`
169
+ } ;
170
+
171
+ // Quick setup the repos, adapter, and grab a simple prompter
172
+ let prompter = quickPrompterSetup ( sh , repoConfig , adapterConfig , dummyCommitMessage , options ) ;
173
+ // TEST
174
+
175
+ // Pass in inquirer but it never gets used since we've mocked out a different
176
+ // version of prompter.
177
+ commitizenCommit ( sh , inquirer , repoConfig . path , prompter , { disableAppendPaths :true , quiet :true , emitData :true } , function ( ) {
178
+ log ( repoConfig . path , function ( logOutput ) {
179
+ expect ( logOutput ) . to . have . string ( author ) ;
180
+ expect ( logOutput ) . to . have . string ( dummyCommitMessage ) ;
181
+ done ( ) ;
182
+ } ) ;
183
+ } ) ;
184
+
185
+ } ) ;
136
186
137
187
} ) ;
138
188
@@ -151,7 +201,7 @@ after(function() {
151
201
* This is just a helper for testing. NOTE that prompter
152
202
* prompter is overriden for testing purposes.
153
203
*/
154
- function quickPrompterSetup ( sh , repoConfig , adapterConfig , commitMessage ) {
204
+ function quickPrompterSetup ( sh , repoConfig , adapterConfig , commitMessage , options = { } ) {
155
205
156
206
commitizenInit ( sh , repoConfig . path , adapterConfig . npmName ) ;
157
207
@@ -160,7 +210,7 @@ function quickPrompterSetup(sh, repoConfig, adapterConfig, commitMessage) {
160
210
// we'll provide prompter. We'd normally use:
161
211
// let prompter = getPrompter(adapterConfig.path);
162
212
let prompter = function ( cz , commit ) {
163
- commit ( commitMessage ) ;
213
+ commit ( commitMessage , options ) ;
164
214
}
165
215
166
216
gitInit ( sh , repoConfig . path ) ;
0 commit comments