@@ -331,16 +331,32 @@ function createSuiteCollector(
331331 // higher priority should be last, run 1, 2, 3, ... etc
332332 . sort ( ( tag1 , tag2 ) => ( tag2 . priority ?? POSITIVE_INFINITY ) - ( tag1 . priority ?? POSITIVE_INFINITY ) )
333333 . reduce ( ( acc , tag ) => {
334- const { name, description, priority, ...options } = tag
334+ const { name, description, priority, meta , ...options } = tag
335335 Object . assign ( acc , options )
336+ if ( meta ) {
337+ acc . meta = Object . assign ( acc . meta ?? Object . create ( null ) , meta )
338+ }
336339 return acc
337340 } , { } as TestOptions )
338341
342+ const testOwnMeta = options . meta
339343 options = {
340344 ...tagsOptions ,
341345 ...options ,
342346 }
343347 const timeout = options . timeout ?? runner . config . testTimeout
348+ const parentMeta = currentSuite ?. meta
349+ const tagMeta = tagsOptions . meta
350+ const testMeta = Object . create ( null )
351+ if ( tagMeta ) {
352+ Object . assign ( testMeta , tagMeta )
353+ }
354+ if ( parentMeta ) {
355+ Object . assign ( testMeta , parentMeta )
356+ }
357+ if ( testOwnMeta ) {
358+ Object . assign ( testMeta , testOwnMeta )
359+ }
344360 const task : Test = {
345361 id : '' ,
346362 name,
@@ -365,7 +381,7 @@ function createSuiteCollector(
365381 : options . todo
366382 ? 'todo'
367383 : 'run' ,
368- meta : options . meta ?? Object . create ( null ) ,
384+ meta : testMeta ,
369385 annotations : [ ] ,
370386 artifacts : [ ] ,
371387 tags : testTags ,
@@ -513,7 +529,7 @@ function createSuiteCollector(
513529 file : ( currentSuite ?. file ?? collectorContext . currentSuite ?. file ) ! ,
514530 shuffle : suiteOptions ?. shuffle ,
515531 tasks : [ ] ,
516- meta : Object . create ( null ) ,
532+ meta : suiteOptions ?. meta ?? Object . create ( null ) ,
517533 concurrent : suiteOptions ?. concurrent ,
518534 tags : unique ( [ ...parentTask ?. tags || [ ] , ...suiteTags ] ) ,
519535 }
@@ -604,9 +620,10 @@ function createSuite() {
604620 const isConcurrentSpecified = options . concurrent || this . concurrent || options . sequential === false
605621 const isSequentialSpecified = options . sequential || this . sequential || options . concurrent === false
606622
623+ const { meta : parentMeta , ...parentOptions } = currentSuite ?. options || { }
607624 // inherit options from current suite
608625 options = {
609- ...currentSuite ?. options ,
626+ ...parentOptions ,
610627 ...options ,
611628 }
612629
@@ -638,6 +655,10 @@ function createSuite() {
638655 options . sequential = isSequential && ! isConcurrent
639656 }
640657
658+ if ( parentMeta ) {
659+ options . meta = Object . assign ( Object . create ( null ) , parentMeta , options . meta )
660+ }
661+
641662 return createSuiteCollector (
642663 formatName ( name ) ,
643664 factory ,
0 commit comments