@@ -74,6 +74,7 @@ const testNamePatterns = testNamePatternFlag?.length > 0 ?
7474 ( re ) => convertStringToRegExp ( re , '--test-name-pattern' )
7575 ) : null ;
7676const kShouldAbort = Symbol ( 'kShouldAbort' ) ;
77+ const kFilename = process . argv ?. [ 1 ] ;
7778const kHookNames = ObjectSeal ( [ 'before' , 'after' , 'beforeEach' , 'afterEach' ] ) ;
7879const kUnwrapErrors = new SafeSet ( )
7980 . add ( kTestCodeFailure ) . add ( kHookFailure )
@@ -632,19 +633,19 @@ class Test extends AsyncResource {
632633 this . parent . processPendingSubtests ( ) ;
633634 } else if ( ! this . reported ) {
634635 this . reported = true ;
635- this . reporter . plan ( this . nesting , this . subtests . length ) ;
636+ this . reporter . plan ( this . nesting , kFilename , this . subtests . length ) ;
636637
637638 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 ] ) ;
639640 }
640641
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( ) } ` ) ;
648649 this . reporter . push ( null ) ;
649650 }
650651 }
@@ -680,7 +681,7 @@ class Test extends AsyncResource {
680681
681682 report ( ) {
682683 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 ) ;
684685 } else {
685686 this . reportStarted ( ) ;
686687 }
@@ -694,14 +695,14 @@ class Test extends AsyncResource {
694695 }
695696
696697 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 ) ;
698699 } else {
699700 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 ) ;
701702 }
702703
703704 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 ] ) ;
705706 }
706707 }
707708
@@ -711,7 +712,7 @@ class Test extends AsyncResource {
711712 }
712713 this . #reportedSubtest = true ;
713714 this . parent . reportStarted ( ) ;
714- this . reporter . start ( this . nesting , this . name ) ;
715+ this . reporter . start ( this . nesting , kFilename , this . name ) ;
715716 }
716717}
717718
0 commit comments