@@ -590,6 +590,8 @@ class Test extends AsyncResource {
590590 this . timeout = kDefaultTimeout ;
591591 this . entryFile = entryFile ;
592592 this . testDisambiguator = new SafeMap ( ) ;
593+ this . nextTestId = 1 ;
594+ this . testId = 0 ;
593595 } else {
594596 const nesting = parent . parent === null ? parent . nesting :
595597 parent . nesting + 1 ;
@@ -606,6 +608,7 @@ class Test extends AsyncResource {
606608 this . childNumber = parent . subtests . length + 1 ;
607609 this . timeout = parent . timeout ;
608610 this . entryFile = parent . entryFile ;
611+ this . testId = this . root . nextTestId ++ ;
609612
610613 if ( isFilteringByName ) {
611614 this . filteredByName = this . willBeFilteredByName ( ) ;
@@ -884,7 +887,7 @@ class Test extends AsyncResource {
884887 const deferred = this . dequeuePendingSubtest ( ) ;
885888 const test = deferred . test ;
886889 this . assignReportOrder ( test ) ;
887- test . reporter . dequeue ( test . nesting , test . loc , test . name , this . reportedType ) ;
890+ test . reporter . dequeue ( test . nesting , test . loc , test . name , this . reportedType , test . testId ) ;
888891 await test . run ( ) ;
889892 deferred . resolve ( ) ;
890893 }
@@ -1141,7 +1144,7 @@ class Test extends AsyncResource {
11411144 // it. Otherwise, return a Promise to the caller and mark the test as
11421145 // pending for later execution.
11431146 this . parent . unfinishedSubtests . add ( this ) ;
1144- this . reporter . enqueue ( this . nesting , this . loc , this . name , this . reportedType ) ;
1147+ this . reporter . enqueue ( this . nesting , this . loc , this . name , this . reportedType , this . testId ) ;
11451148 if ( this . root . harness . buildPromise || ! this . parent . hasConcurrency ( ) ) {
11461149 const deferred = PromiseWithResolvers ( ) ;
11471150
@@ -1164,7 +1167,7 @@ class Test extends AsyncResource {
11641167 }
11651168
11661169 this . parent . assignReportOrder ( this ) ;
1167- this . reporter . dequeue ( this . nesting , this . loc , this . name , this . reportedType ) ;
1170+ this . reporter . dequeue ( this . nesting , this . loc , this . name , this . reportedType , this . testId ) ;
11681171 return this . run ( ) ;
11691172 }
11701173
@@ -1426,7 +1429,10 @@ class Test extends AsyncResource {
14261429 const report = this . getReportDetails ( ) ;
14271430 report . details . passed = this . passed ;
14281431 this . testNumber ||= ++ this . parent . outputSubtestCount ;
1429- this . reporter . complete ( this . nesting , this . loc , this . testNumber , this . name , report . details , report . directive ) ;
1432+ this . reporter . complete (
1433+ this . nesting , this . loc , this . testNumber , this . name ,
1434+ report . details , report . directive , this . testId ,
1435+ ) ;
14301436 this . parent . activeSubtests -- ;
14311437 }
14321438
@@ -1579,9 +1585,15 @@ class Test extends AsyncResource {
15791585 const report = this . getReportDetails ( ) ;
15801586
15811587 if ( this . passed ) {
1582- this . reporter . ok ( this . nesting , this . loc , this . testNumber , this . name , report . details , report . directive ) ;
1588+ this . reporter . ok (
1589+ this . nesting , this . loc , this . testNumber , this . name ,
1590+ report . details , report . directive , this . testId ,
1591+ ) ;
15831592 } else {
1584- this . reporter . fail ( this . nesting , this . loc , this . testNumber , this . name , report . details , report . directive ) ;
1593+ this . reporter . fail (
1594+ this . nesting , this . loc , this . testNumber , this . name ,
1595+ report . details , report . directive , this . testId ,
1596+ ) ;
15851597 }
15861598
15871599 for ( let i = 0 ; i < this . diagnostics . length ; i ++ ) {
@@ -1595,7 +1607,7 @@ class Test extends AsyncResource {
15951607 }
15961608 this . #reportedSubtest = true ;
15971609 this . parent . reportStarted ( ) ;
1598- this . reporter . start ( this . nesting , this . loc , this . name ) ;
1610+ this . reporter . start ( this . nesting , this . loc , this . name , this . testId ) ;
15991611 }
16001612
16011613 clearExecutionTime ( ) {
0 commit comments