@@ -594,6 +594,8 @@ test('results when fail-fast is enabled', t => {
594
594
runStatus . remainingCount = 1 ;
595
595
runStatus . failCount = 1 ;
596
596
runStatus . failFastEnabled = true ;
597
+ runStatus . fileCount = 1 ;
598
+ runStatus . observationCount = 1 ;
597
599
runStatus . tests = [ {
598
600
title : 'failed test'
599
601
} ] ;
@@ -616,6 +618,8 @@ test('results when fail-fast is enabled with multiple skipped tests', t => {
616
618
runStatus . remainingCount = 2 ;
617
619
runStatus . failCount = 1 ;
618
620
runStatus . failFastEnabled = true ;
621
+ runStatus . fileCount = 1 ;
622
+ runStatus . observationCount = 1 ;
619
623
runStatus . tests = [ {
620
624
title : 'failed test'
621
625
} ] ;
@@ -632,13 +636,87 @@ test('results when fail-fast is enabled with multiple skipped tests', t => {
632
636
t . end ( ) ;
633
637
} ) ;
634
638
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
+
635
711
test ( 'results without fail-fast if no failing tests' , t => {
636
712
const reporter = createReporter ( ) ;
637
713
const runStatus = createRunStatus ( ) ;
638
714
runStatus . remainingCount = 1 ;
639
715
runStatus . failCount = 0 ;
640
716
runStatus . passCount = 1 ;
641
717
runStatus . failFastEnabled = true ;
718
+ runStatus . fileCount = 1 ;
719
+ runStatus . observationCount = 1 ;
642
720
643
721
const output = reporter . finish ( runStatus ) ;
644
722
const expectedOutput = [
@@ -657,6 +735,8 @@ test('results without fail-fast if no skipped tests', t => {
657
735
runStatus . remainingCount = 0 ;
658
736
runStatus . failCount = 1 ;
659
737
runStatus . failFastEnabled = true ;
738
+ runStatus . fileCount = 1 ;
739
+ runStatus . observationCount = 1 ;
660
740
runStatus . tests = [ {
661
741
title : 'failed test'
662
742
} ] ;
0 commit comments