github.com/onsi/ginkgo@v1.16.6-0.20211118180735-4e1925ba4c95/internal/internal_integration/config_fail_fast_test.go (about)

     1  package internal_integration_test
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo"
     5  	. "github.com/onsi/ginkgo/internal/test_helpers"
     6  	. "github.com/onsi/gomega"
     7  )
     8  
     9  var _ = Describe("when config.FailFast is enabled", func() {
    10  	BeforeEach(func() {
    11  		SetUpForParallel(2)
    12  		conf.FailFast = true
    13  
    14  		Ω(client.ShouldAbort()).Should(BeFalse())
    15  		RunFixture("fail fast", func() {
    16  			Describe("a container", func() {
    17  				BeforeEach(rt.T("bef"))
    18  				It("A", rt.T("A"))
    19  				It("B", rt.T("B", func() { F() }))
    20  				It("C", rt.T("C", func() { F() }))
    21  				It("D", rt.T("D"))
    22  				AfterEach(rt.T("aft"))
    23  			})
    24  			AfterSuite(rt.T("after-suite"))
    25  		})
    26  	})
    27  
    28  	It("does not run any tests after the failure occurs, but does run the failed tests's after each and the after suite", func() {
    29  		Ω(rt).Should(HaveTracked(
    30  			"bef", "A", "aft",
    31  			"bef", "B", "aft",
    32  			"after-suite",
    33  		))
    34  	})
    35  
    36  	It("reports that the tests were skipped", func() {
    37  		Ω(reporter.Did.Find("A")).Should(HavePassed())
    38  		Ω(reporter.Did.Find("B")).Should(HaveFailed())
    39  		Ω(reporter.Did.Find("C")).Should(HaveBeenSkipped())
    40  		Ω(reporter.Did.Find("D")).Should(HaveBeenSkipped())
    41  	})
    42  
    43  	It("reports the correct statistics", func() {
    44  		Ω(reporter.End).Should(BeASuiteSummary(NSpecs(4), NPassed(1), NFailed(1), NSkipped(2)))
    45  	})
    46  
    47  	It("tells the server to abort", func() {
    48  		Ω(client.ShouldAbort()).Should(BeTrue())
    49  	})
    50  })