@@ -80,7 +80,7 @@ function createSuiteCollector(name: string, factory: SuiteFactory = () => { }, m
8080 meta : options . meta ?? Object . create ( null ) ,
8181 }
8282 const handler = options . handler
83- if ( options . concurrent || ( ! sequential && ( concurrent || runner . config . sequence . concurrent ) ) )
83+ if ( options . concurrent || ( ! options . sequential && runner . config . sequence . concurrent ) )
8484 task . concurrent = true
8585 if ( shuffle )
8686 task . shuffle = true
@@ -104,14 +104,18 @@ function createSuiteCollector(name: string, factory: SuiteFactory = () => { }, m
104104 return task
105105 }
106106
107- const test = createTest ( function ( name : string | Function , fn = noop , options ) {
107+ const test = createTest ( function ( name : string | Function , fn = noop , options = { } ) {
108108 if ( typeof options === 'number' )
109109 options = { timeout : options }
110110
111111 // inherit repeats, retry, timeout from suite
112112 if ( typeof suiteOptions === 'object' )
113113 options = Object . assign ( { } , suiteOptions , options )
114114
115+ // inherit concurrent / sequential from suite
116+ options . concurrent = this . concurrent || ( ! this . sequential && options ?. concurrent )
117+ options . sequential = this . sequential || ( ! this . concurrent && options ?. sequential )
118+
115119 const test = task (
116120 formatName ( name ) ,
117121 { ...this , ...options , handler : fn as any } ,
@@ -188,7 +192,7 @@ function createSuiteCollector(name: string, factory: SuiteFactory = () => { }, m
188192}
189193
190194function createSuite ( ) {
191- function suiteFn ( this : Record < string , boolean | undefined > , name : string | Function , factory ?: SuiteFactory , options ? : number | TestOptions ) {
195+ function suiteFn ( this : Record < string , boolean | undefined > , name : string | Function , factory ?: SuiteFactory , options : number | TestOptions = { } ) {
192196 const mode : RunMode = this . only ? 'only' : this . skip ? 'skip' : this . todo ? 'todo' : 'run'
193197 const currentSuite = getCurrentSuite ( )
194198
@@ -199,7 +203,11 @@ function createSuite() {
199203 if ( currentSuite ?. options )
200204 options = { ...currentSuite . options , ...options }
201205
202- return createSuiteCollector ( formatName ( name ) , factory , mode , this . concurrent , this . sequence , this . shuffle , this . each , options )
206+ // inherit concurrent / sequential from current suite
207+ options . concurrent = this . concurrent || ( ! this . sequential && options ?. concurrent )
208+ options . sequential = this . sequential || ( ! this . concurrent && options ?. sequential )
209+
210+ return createSuiteCollector ( formatName ( name ) , factory , mode , this . concurrent , this . sequential , this . shuffle , this . each , options )
203211 }
204212
205213 suiteFn . each = function < T > ( this : { withContext : ( ) => SuiteAPI ; setContext : ( key : string , value : boolean | undefined ) => SuiteAPI } , cases : ReadonlyArray < T > , ...args : any [ ] ) {
0 commit comments