@@ -594,6 +594,8 @@ test('results when fail-fast is enabled', t => {
594594 runStatus . remainingCount = 1 ;
595595 runStatus . failCount = 1 ;
596596 runStatus . failFastEnabled = true ;
597+ runStatus . fileCount = 1 ;
598+ runStatus . observationCount = 1 ;
597599 runStatus . tests = [ {
598600 title : 'failed test'
599601 } ] ;
@@ -616,6 +618,8 @@ test('results when fail-fast is enabled with multiple skipped tests', t => {
616618 runStatus . remainingCount = 2 ;
617619 runStatus . failCount = 1 ;
618620 runStatus . failFastEnabled = true ;
621+ runStatus . fileCount = 1 ;
622+ runStatus . observationCount = 1 ;
619623 runStatus . tests = [ {
620624 title : 'failed test'
621625 } ] ;
@@ -632,13 +636,87 @@ test('results when fail-fast is enabled with multiple skipped tests', t => {
632636 t . end ( ) ;
633637} ) ;
634638
639+ test ( 'results when fail-fast is enabled with skipped test file' , t => {
640+ const reporter = createReporter ( ) ;
641+ const runStatus = createRunStatus ( ) ;
642+ runStatus . remainingCount = 0 ;
643+ runStatus . failCount = 1 ;
644+ runStatus . failFastEnabled = true ;
645+ runStatus . fileCount = 2 ;
646+ runStatus . observationCount = 1 ;
647+ runStatus . tests = [ {
648+ title : 'failed test'
649+ } ] ;
650+
651+ const output = reporter . finish ( runStatus ) ;
652+ const expectedOutput = [
653+ '\n ' + colors . red ( '1 test failed' ) ,
654+ '\n' ,
655+ '\n ' + colors . magenta ( '`--fail-fast` is on. 1 test file was skipped.' ) ,
656+ '\n'
657+ ] . join ( '' ) ;
658+
659+ t . is ( output , expectedOutput ) ;
660+ t . end ( ) ;
661+ } ) ;
662+
663+ test ( 'results when fail-fast is enabled with multiple skipped test files' , t => {
664+ const reporter = createReporter ( ) ;
665+ const runStatus = createRunStatus ( ) ;
666+ runStatus . remainingCount = 0 ;
667+ runStatus . failCount = 1 ;
668+ runStatus . failFastEnabled = true ;
669+ runStatus . fileCount = 3 ;
670+ runStatus . observationCount = 1 ;
671+ runStatus . tests = [ {
672+ title : 'failed test'
673+ } ] ;
674+
675+ const output = reporter . finish ( runStatus ) ;
676+ const expectedOutput = [
677+ '\n ' + colors . red ( '1 test failed' ) ,
678+ '\n' ,
679+ '\n ' + colors . magenta ( '`--fail-fast` is on. 2 test files were skipped.' ) ,
680+ '\n'
681+ ] . join ( '' ) ;
682+
683+ t . is ( output , expectedOutput ) ;
684+ t . end ( ) ;
685+ } ) ;
686+
687+ test ( 'results when fail-fast is enabled with skipped tests and files' , t => {
688+ const reporter = createReporter ( ) ;
689+ const runStatus = createRunStatus ( ) ;
690+ runStatus . remainingCount = 1 ;
691+ runStatus . failCount = 1 ;
692+ runStatus . failFastEnabled = true ;
693+ runStatus . fileCount = 3 ;
694+ runStatus . observationCount = 1 ;
695+ runStatus . tests = [ {
696+ title : 'failed test'
697+ } ] ;
698+
699+ const output = reporter . finish ( runStatus ) ;
700+ const expectedOutput = [
701+ '\n ' + colors . red ( '1 test failed' ) ,
702+ '\n' ,
703+ '\n ' + colors . magenta ( '`--fail-fast` is on. At least 1 test was skipped, as well as 2 test files.' ) ,
704+ '\n'
705+ ] . join ( '' ) ;
706+
707+ t . is ( output , expectedOutput ) ;
708+ t . end ( ) ;
709+ } ) ;
710+
635711test ( 'results without fail-fast if no failing tests' , t => {
636712 const reporter = createReporter ( ) ;
637713 const runStatus = createRunStatus ( ) ;
638714 runStatus . remainingCount = 1 ;
639715 runStatus . failCount = 0 ;
640716 runStatus . passCount = 1 ;
641717 runStatus . failFastEnabled = true ;
718+ runStatus . fileCount = 1 ;
719+ runStatus . observationCount = 1 ;
642720
643721 const output = reporter . finish ( runStatus ) ;
644722 const expectedOutput = [
@@ -657,6 +735,8 @@ test('results without fail-fast if no skipped tests', t => {
657735 runStatus . remainingCount = 0 ;
658736 runStatus . failCount = 1 ;
659737 runStatus . failFastEnabled = true ;
738+ runStatus . fileCount = 1 ;
739+ runStatus . observationCount = 1 ;
660740 runStatus . tests = [ {
661741 title : 'failed test'
662742 } ] ;
0 commit comments