@@ -244,4 +244,30 @@ describe('Git commands', () => {
244
244
expect ( log [ 2 ] . hash ) . toHaveLength ( 7 )
245
245
expect ( log [ 2 ] . message ) . toBe ( 'Third commit' )
246
246
} )
247
+
248
+ it ( 'Verifies log does not contain commits matching regex' , async ( ) => {
249
+ const cwd = await initTestRepo ( )
250
+
251
+ const settings = { } as Settings
252
+ settings . gitPath = await io . which ( 'git' , true )
253
+ settings . repoPath = cwd
254
+ settings . filterRegex = / ^ \[ s k i p \] .* /
255
+ const g = new Git ( settings )
256
+
257
+ await createAndCommitFile ( 'first' , 'First commit' , cwd )
258
+ await createAndCommitFile ( 'second' , '[skip] Second commit' , cwd )
259
+ await createAndCommitFile ( 'third' , 'Third commit' , cwd )
260
+ await createAndCommitFile ( 'fourth' , 'Fourth commit' , cwd )
261
+ await createAndCommitFile ( 'fifth' , '[skip] Fifth commit' , cwd )
262
+ await createAndCommitFile ( 'sixth' , '[skip] Sixth commit' , cwd )
263
+
264
+ const log = await g . log ( '' , '' )
265
+ expect ( log ) . toHaveLength ( 3 )
266
+ expect ( log [ 0 ] . hash ) . toHaveLength ( 7 )
267
+ expect ( log [ 0 ] . message ) . toBe ( 'Fourth commit' )
268
+ expect ( log [ 1 ] . hash ) . toHaveLength ( 7 )
269
+ expect ( log [ 1 ] . message ) . toBe ( 'Third commit' )
270
+ expect ( log [ 2 ] . hash ) . toHaveLength ( 7 )
271
+ expect ( log [ 2 ] . message ) . toBe ( 'First commit' )
272
+ } )
247
273
} )
0 commit comments