@@ -29,15 +29,15 @@ beforeEach(function() {
29
29
} ) ;
30
30
31
31
describe ( 'commit' , function ( ) {
32
-
32
+
33
33
it ( 'should commit simple messages' , function ( done ) {
34
-
34
+
35
35
this . timeout ( config . maxTimeout ) ; // this could take a while
36
-
36
+
37
37
// SETUP
38
-
38
+
39
39
let dummyCommitMessage = `sip sip sippin on some sizzurp` ;
40
-
40
+
41
41
// Describe a repo and some files to add and commit
42
42
let repoConfig = {
43
43
path : config . paths . endUserRepo ,
@@ -52,17 +52,17 @@ describe('commit', function() {
52
52
}
53
53
}
54
54
} ;
55
-
55
+
56
56
// Describe an adapter
57
57
let adapterConfig = {
58
58
path : path . join ( repoConfig . path , '/node_modules/cz-jira-smart-commit' ) ,
59
59
npmName : 'cz-jira-smart-commit'
60
60
} ;
61
-
61
+
62
62
// Quick setup the repos, adapter, and grab a simple prompter
63
63
let prompter = quickPrompterSetup ( sh , repoConfig , adapterConfig , dummyCommitMessage ) ;
64
64
// TEST
65
-
65
+
66
66
// Pass in inquirer but it never gets used since we've mocked out a different
67
67
// version of prompter.
68
68
commitizenCommit ( sh , inquirer , repoConfig . path , prompter , { disableAppendPaths :true , quiet :true , emitData :true } , function ( ) {
@@ -73,7 +73,7 @@ describe('commit', function() {
73
73
} ) ;
74
74
75
75
} ) ;
76
-
76
+
77
77
it ( 'should commit message with quotes' , function ( done ) {
78
78
79
79
this . timeout ( config . maxTimeout ) ; // this could take a while
@@ -120,29 +120,29 @@ describe('commit', function() {
120
120
121
121
122
122
it ( 'should commit multiline messages' , function ( done ) {
123
-
123
+
124
124
this . timeout ( config . maxTimeout ) ; // this could take a while
125
-
125
+
126
126
// SETUP
127
-
127
+
128
128
// Don't trim or delete the spacing in this commit message!
129
-
129
+
130
130
// Git on *nix retains spaces on lines with only spaces
131
131
// The blank line of this block should have 4 spaces.
132
132
let nixCommitMessage =
133
133
`sip sip sippin on jnkjnkjn
134
134
135
135
some sizzurp` ;
136
-
136
+
137
137
// Git on win32 removes spaces from lines with only spaces
138
138
// The blank line of this block should have no spaces
139
139
let windowsCommitMessage =
140
140
`sip sip sippin on jnkjnkjn
141
141
142
142
some sizzurp` ;
143
-
143
+
144
144
let dummyCommitMessage = ( os . platform == 'win32' ) ? windowsCommitMessage : nixCommitMessage ;
145
-
145
+
146
146
// Describe a repo and some files to add and commit
147
147
let repoConfig = {
148
148
path : config . paths . endUserRepo ,
@@ -157,17 +157,17 @@ describe('commit', function() {
157
157
}
158
158
}
159
159
} ;
160
-
160
+
161
161
// Describe an adapter
162
162
let adapterConfig = {
163
163
path : path . join ( repoConfig . path , '/node_modules/cz-conventional-changelog' ) ,
164
164
npmName : 'cz-conventional-changelog'
165
165
} ;
166
-
166
+
167
167
// Quick setup the repos, adapter, and grab a simple prompter
168
168
let prompter = quickPrompterSetup ( sh , repoConfig , adapterConfig , dummyCommitMessage ) ;
169
169
// TEST
170
-
170
+
171
171
// Pass in inquirer but it never gets used since we've mocked out a different
172
172
// version of prompter.
173
173
commitizenCommit ( sh , inquirer , repoConfig . path , prompter , { disableAppendPaths :true , quiet :true } , function ( ) {
@@ -180,14 +180,14 @@ describe('commit', function() {
180
180
} ) ;
181
181
182
182
it ( 'should allow to override git commit options' , function ( done ) {
183
-
183
+
184
184
this . timeout ( config . maxTimeout ) ; // this could take a while
185
-
185
+
186
186
// SETUP
187
-
187
+
188
188
let dummyCommitMessage = `sip sip sippin on some sizzurp` ;
189
189
let author = `A U Thor <[email protected] >` ;
190
-
190
+
191
191
// Describe a repo and some files to add and commit
192
192
let repoConfig = {
193
193
path : config . paths . endUserRepo ,
@@ -202,21 +202,21 @@ describe('commit', function() {
202
202
}
203
203
}
204
204
} ;
205
-
205
+
206
206
// Describe an adapter
207
207
let adapterConfig = {
208
208
path : path . join ( repoConfig . path , '/node_modules/cz-jira-smart-commit' ) ,
209
209
npmName : 'cz-jira-smart-commit'
210
210
} ;
211
-
211
+
212
212
let options = {
213
213
args : `--author="${ author } " --no-edit`
214
214
} ;
215
-
215
+
216
216
// Quick setup the repos, adapter, and grab a simple prompter
217
217
let prompter = quickPrompterSetup ( sh , repoConfig , adapterConfig , dummyCommitMessage , options ) ;
218
218
// TEST
219
-
219
+
220
220
// Pass in inquirer but it never gets used since we've mocked out a different
221
221
// version of prompter.
222
222
commitizenCommit ( sh , inquirer , repoConfig . path , prompter , { disableAppendPaths :true , quiet :true , emitData :true } , function ( ) {
@@ -228,15 +228,17 @@ describe('commit', function() {
228
228
} ) ;
229
229
230
230
} ) ;
231
-
231
+
232
232
} ) ;
233
233
234
234
afterEach ( function ( ) {
235
+ this . timeout ( config . maxTimeout ) ; // this could take a while
235
236
// All this should do is archive the tmp path to the artifacts
236
237
clean . afterEach ( sh , config . paths . tmp , config . preserve ) ;
237
238
} ) ;
238
239
239
240
after ( function ( ) {
241
+ this . timeout ( config . maxTimeout ) ; // this could take a while
240
242
// Once everything is done, the artifacts should be cleaned up based on
241
243
// the preserve setting in the config
242
244
clean . after ( sh , config . paths . tmp , config . preserve ) ;
@@ -247,23 +249,23 @@ after(function() {
247
249
* prompter is overriden for testing purposes.
248
250
*/
249
251
function quickPrompterSetup ( sh , repoConfig , adapterConfig , commitMessage , options = { } ) {
250
-
252
+
251
253
commitizenInit ( sh , repoConfig . path , adapterConfig . npmName ) ;
252
-
254
+
253
255
// NOTE:
254
256
// In our real code we'd use this here but since we're testing,
255
257
// we'll provide prompter. We'd normally use:
256
258
// let prompter = getPrompter(adapterConfig.path);
257
259
let prompter = function ( cz , commit ) {
258
260
commit ( commitMessage , options ) ;
259
261
}
260
-
262
+
261
263
gitInit ( sh , repoConfig . path ) ;
262
-
264
+
263
265
writeFilesToPath ( repoConfig . files , repoConfig . path ) ;
264
-
266
+
265
267
gitAdd ( sh , repoConfig . path ) ;
266
-
268
+
267
269
// NOTE: In the real world we would not be returning
268
270
// this we would instead be just making the commented
269
271
// out getPrompter() call to get user input (above).
0 commit comments