@@ -322,20 +322,30 @@ class TestRunner extends EventEmitter {
322
322
}
323
323
}
324
324
325
+ const duplicateTest = ( amount , mode , timeout ) => {
326
+ return ( name , callback ) => {
327
+ for ( let i = 0 ; i < amount ; ++ i )
328
+ this . _addTest ( name , callback , mode , timeout ) ;
329
+ }
330
+ }
331
+
332
+ const duplicateSuite = ( amount , mode ) => {
333
+ return ( name , callback , ...args ) => {
334
+ for ( let i = 0 ; i < amount ; ++ i )
335
+ this . _addSuite ( mode , name , callback , ...args ) ;
336
+ }
337
+ }
338
+
325
339
// bind methods so that they can be used as a DSL.
326
340
this . describe = this . _addSuite . bind ( this , TestMode . Run ) ;
327
341
this . describe . skip = condition => condition ? this . xdescribe : this . describe ;
342
+ this . describe . repeat = number => duplicateSuite ( number , TestMode . Run ) ;
328
343
this . fdescribe = this . _addSuite . bind ( this , TestMode . Focus ) ;
329
344
this . fdescribe . skip = ( ) => this . fdescribe ; // no-op
345
+ this . fdescribe . repeat = number => duplicateSuite ( number , TestMode . Focus ) ;
330
346
this . xdescribe = this . _addSuite . bind ( this , TestMode . Skip ) ;
331
347
this . xdescribe . skip = ( ) => this . xdescribe ; // no-op
332
-
333
- const duplicateTest = ( amount , mode , timeout ) => {
334
- return ( name , callback ) => {
335
- for ( let i = 0 ; i < amount ; ++ i )
336
- this . _addTest ( name , callback , mode , timeout ) ;
337
- }
338
- }
348
+ this . xdescribe . repeat = number => duplicateSuite ( number , TestMode . Skip ) ;
339
349
340
350
this . it = ( name , callback ) => void this . _addTest ( name , callback , TestMode . Run , this . _timeout ) ;
341
351
this . it . skip = condition => condition ? this . xit : this . it ;
0 commit comments