@@ -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 ( ) ;
@@ -890,7 +893,7 @@ class Test extends AsyncResource {
890893 const deferred = this . dequeuePendingSubtest ( ) ;
891894 const test = deferred . test ;
892895 this . assignReportOrder ( test ) ;
893- test . reporter . dequeue ( test . nesting , test . loc , test . name , this . reportedType ) ;
896+ test . reporter . dequeue ( test . nesting , test . loc , test . name , this . reportedType , test . testId ) ;
894897 await test . run ( ) ;
895898 deferred . resolve ( ) ;
896899 }
@@ -1147,7 +1150,7 @@ class Test extends AsyncResource {
11471150 // it. Otherwise, return a Promise to the caller and mark the test as
11481151 // pending for later execution.
11491152 this . parent . unfinishedSubtests . add ( this ) ;
1150- this . reporter . enqueue ( this . nesting , this . loc , this . name , this . reportedType ) ;
1153+ this . reporter . enqueue ( this . nesting , this . loc , this . name , this . reportedType , this . testId ) ;
11511154 if ( this . root . harness . buildPromise || ! this . parent . hasConcurrency ( ) ) {
11521155 const deferred = PromiseWithResolvers ( ) ;
11531156
@@ -1170,7 +1173,7 @@ class Test extends AsyncResource {
11701173 }
11711174
11721175 this . parent . assignReportOrder ( this ) ;
1173- this . reporter . dequeue ( this . nesting , this . loc , this . name , this . reportedType ) ;
1176+ this . reporter . dequeue ( this . nesting , this . loc , this . name , this . reportedType , this . testId ) ;
11741177 return this . run ( ) ;
11751178 }
11761179
@@ -1432,7 +1435,10 @@ class Test extends AsyncResource {
14321435 const report = this . getReportDetails ( ) ;
14331436 report . details . passed = this . passed ;
14341437 this . testNumber ||= ++ this . parent . outputSubtestCount ;
1435- this . reporter . complete ( this . nesting , this . loc , this . testNumber , this . name , report . details , report . directive ) ;
1438+ this . reporter . complete (
1439+ this . nesting , this . loc , this . testNumber , this . name ,
1440+ report . details , report . directive , this . testId ,
1441+ ) ;
14361442 this . parent . activeSubtests -- ;
14371443 }
14381444
@@ -1585,9 +1591,15 @@ class Test extends AsyncResource {
15851591 const report = this . getReportDetails ( ) ;
15861592
15871593 if ( this . passed ) {
1588- this . reporter . ok ( this . nesting , this . loc , this . testNumber , this . name , report . details , report . directive ) ;
1594+ this . reporter . ok (
1595+ this . nesting , this . loc , this . testNumber , this . name ,
1596+ report . details , report . directive , this . testId ,
1597+ ) ;
15891598 } else {
1590- this . reporter . fail ( this . nesting , this . loc , this . testNumber , this . name , report . details , report . directive ) ;
1599+ this . reporter . fail (
1600+ this . nesting , this . loc , this . testNumber , this . name ,
1601+ report . details , report . directive , this . testId ,
1602+ ) ;
15911603 }
15921604
15931605 for ( let i = 0 ; i < this . diagnostics . length ; i ++ ) {
@@ -1601,7 +1613,7 @@ class Test extends AsyncResource {
16011613 }
16021614 this . #reportedSubtest = true ;
16031615 this . parent . reportStarted ( ) ;
1604- this . reporter . start ( this . nesting , this . loc , this . name ) ;
1616+ this . reporter . start ( this . nesting , this . loc , this . name , this . testId ) ;
16051617 }
16061618
16071619 clearExecutionTime ( ) {
0 commit comments