@@ -74,6 +74,7 @@ const testNamePatterns = testNamePatternFlag?.length > 0 ?
74
74
( re ) => convertStringToRegExp ( re , '--test-name-pattern' )
75
75
) : null ;
76
76
const kShouldAbort = Symbol ( 'kShouldAbort' ) ;
77
+ const kFilename = process . argv ?. [ 1 ] ;
77
78
const kHookNames = ObjectSeal ( [ 'before' , 'after' , 'beforeEach' , 'afterEach' ] ) ;
78
79
const kUnwrapErrors = new SafeSet ( )
79
80
. add ( kTestCodeFailure ) . add ( kHookFailure )
@@ -632,19 +633,19 @@ class Test extends AsyncResource {
632
633
this . parent . processPendingSubtests ( ) ;
633
634
} else if ( ! this . reported ) {
634
635
this . reported = true ;
635
- this . reporter . plan ( this . nesting , this . subtests . length ) ;
636
+ this . reporter . plan ( this . nesting , kFilename , this . subtests . length ) ;
636
637
637
638
for ( let i = 0 ; i < this . diagnostics . length ; i ++ ) {
638
- this . reporter . diagnostic ( this . nesting , this . diagnostics [ i ] ) ;
639
+ this . reporter . diagnostic ( this . nesting , kFilename , this . diagnostics [ i ] ) ;
639
640
}
640
641
641
- this . reporter . diagnostic ( this . nesting , `tests ${ this . subtests . length } ` ) ;
642
- this . reporter . diagnostic ( this . nesting , `pass ${ counters . passed } ` ) ;
643
- this . reporter . diagnostic ( this . nesting , `fail ${ counters . failed } ` ) ;
644
- this . reporter . diagnostic ( this . nesting , `cancelled ${ counters . cancelled } ` ) ;
645
- this . reporter . diagnostic ( this . nesting , `skipped ${ counters . skipped } ` ) ;
646
- this . reporter . diagnostic ( this . nesting , `todo ${ counters . todo } ` ) ;
647
- this . reporter . diagnostic ( this . nesting , `duration_ms ${ this . #duration( ) } ` ) ;
642
+ this . reporter . diagnostic ( this . nesting , kFilename , `tests ${ this . subtests . length } ` ) ;
643
+ this . reporter . diagnostic ( this . nesting , kFilename , `pass ${ counters . passed } ` ) ;
644
+ this . reporter . diagnostic ( this . nesting , kFilename , `fail ${ counters . failed } ` ) ;
645
+ this . reporter . diagnostic ( this . nesting , kFilename , `cancelled ${ counters . cancelled } ` ) ;
646
+ this . reporter . diagnostic ( this . nesting , kFilename , `skipped ${ counters . skipped } ` ) ;
647
+ this . reporter . diagnostic ( this . nesting , kFilename , `todo ${ counters . todo } ` ) ;
648
+ this . reporter . diagnostic ( this . nesting , kFilename , `duration_ms ${ this . #duration( ) } ` ) ;
648
649
this . reporter . push ( null ) ;
649
650
}
650
651
}
@@ -680,7 +681,7 @@ class Test extends AsyncResource {
680
681
681
682
report ( ) {
682
683
if ( this . subtests . length > 0 ) {
683
- this . reporter . plan ( this . subtests [ 0 ] . nesting , this . subtests . length ) ;
684
+ this . reporter . plan ( this . subtests [ 0 ] . nesting , kFilename , this . subtests . length ) ;
684
685
} else {
685
686
this . reportStarted ( ) ;
686
687
}
@@ -694,14 +695,14 @@ class Test extends AsyncResource {
694
695
}
695
696
696
697
if ( this . passed ) {
697
- this . reporter . ok ( this . nesting , this . testNumber , this . name , details , directive ) ;
698
+ this . reporter . ok ( this . nesting , kFilename , this . testNumber , this . name , details , directive ) ;
698
699
} else {
699
700
details . error = this . error ;
700
- this . reporter . fail ( this . nesting , this . testNumber , this . name , details , directive ) ;
701
+ this . reporter . fail ( this . nesting , kFilename , this . testNumber , this . name , details , directive ) ;
701
702
}
702
703
703
704
for ( let i = 0 ; i < this . diagnostics . length ; i ++ ) {
704
- this . reporter . diagnostic ( this . nesting , this . diagnostics [ i ] ) ;
705
+ this . reporter . diagnostic ( this . nesting , kFilename , this . diagnostics [ i ] ) ;
705
706
}
706
707
}
707
708
@@ -711,7 +712,7 @@ class Test extends AsyncResource {
711
712
}
712
713
this . #reportedSubtest = true ;
713
714
this . parent . reportStarted ( ) ;
714
- this . reporter . start ( this . nesting , this . name ) ;
715
+ this . reporter . start ( this . nesting , kFilename , this . name ) ;
715
716
}
716
717
}
717
718
0 commit comments