@@ -53,15 +53,15 @@ export function createSuiteHooks() {
53
53
}
54
54
55
55
// implementations
56
- function createSuiteCollector ( name : string , factory : SuiteFactory = ( ) => { } , mode : RunMode , concurrent ?: boolean , shuffle ?: boolean , suiteOptions ?: number | TestOptions ) {
56
+ function createSuiteCollector ( name : string , factory : SuiteFactory = ( ) => { } , mode : RunMode , concurrent ?: boolean , shuffle ?: boolean , suiteOptions ?: TestOptions ) {
57
57
const tasks : ( Test | TaskCustom | Suite | SuiteCollector ) [ ] = [ ]
58
58
const factoryQueue : ( Test | Suite | SuiteCollector ) [ ] = [ ]
59
59
60
60
let suite : Suite
61
61
62
62
initSuite ( )
63
63
64
- const test = createTest ( function ( name : string , fn = noop , options = suiteOptions ) {
64
+ const test = createTest ( function ( name : string , fn = noop , options ) {
65
65
const mode = this . only ? 'only' : this . skip ? 'skip' : this . todo ? 'todo' : 'run'
66
66
67
67
if ( typeof options === 'number' )
@@ -70,7 +70,8 @@ function createSuiteCollector(name: string, factory: SuiteFactory = () => { }, m
70
70
// inherit repeats and retry from suite
71
71
if ( typeof suiteOptions === 'object' ) {
72
72
options = {
73
- ...suiteOptions ,
73
+ repeats : suiteOptions . repeats ,
74
+ retry : suiteOptions . retry ,
74
75
...options ,
75
76
}
76
77
}
@@ -122,6 +123,7 @@ function createSuiteCollector(name: string, factory: SuiteFactory = () => { }, m
122
123
type : 'collector' ,
123
124
name,
124
125
mode,
126
+ options : suiteOptions ,
125
127
test,
126
128
tasks,
127
129
collect,
@@ -186,6 +188,16 @@ function createSuite() {
186
188
function suiteFn ( this : Record < string , boolean | undefined > , name : string , factory ?: SuiteFactory , options ?: number | TestOptions ) {
187
189
checkVersion ( )
188
190
const mode : RunMode = this . only ? 'only' : this . skip ? 'skip' : this . todo ? 'todo' : 'run'
191
+ const currentSuite = getCurrentSuite ( )
192
+
193
+ if ( typeof options === 'number' )
194
+ options = { timeout : options }
195
+
196
+ if ( currentSuite && typeof currentSuite . options ?. repeats === 'number' ) {
197
+ // inherit repeats from current suite
198
+ options = { repeats : currentSuite . options . repeats , ...options }
199
+ }
200
+
189
201
return createSuiteCollector ( name , factory , mode , this . concurrent , this . shuffle , options )
190
202
}
191
203
0 commit comments