github.com/onsi/ginkgo@v1.16.6-0.20211118180735-4e1925ba4c95/internal/internal_integration/config_dry_run_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.DryRun is enabled", func() {
    10  	BeforeEach(func() {
    11  		conf.DryRun = true
    12  		conf.SkipStrings = []string{"E"}
    13  
    14  		RunFixture("dry run", func() {
    15  			BeforeSuite(rt.T("before-suite"))
    16  			BeforeEach(rt.T("bef"))
    17  			ReportBeforeEach(func(_ SpecReport) { rt.Run("report-before-each") })
    18  			Describe("container", func() {
    19  				It("A", rt.T("A"))
    20  				It("B", rt.T("B", func() { F() }))
    21  				PIt("C", rt.T("C", func() { F() }))
    22  				It("D", rt.T("D"))
    23  				It("E", rt.T("D"))
    24  			})
    25  			AfterEach(rt.T("aft"))
    26  			AfterSuite(rt.T("after-suite"))
    27  			ReportAfterEach(func(_ SpecReport) { rt.Run("report-after-each") })
    28  			ReportAfterSuite("", func(_ Report) { rt.Run("report-after-suite") })
    29  		})
    30  	})
    31  
    32  	It("does not run any tests", func() {
    33  		Ω(rt).Should(HaveTrackedNothing())
    34  	})
    35  
    36  	It("reports on the tests (both that they will run and that they did run) and honors skip state", func() {
    37  		Ω(reporter.Will.Names()).Should(Equal([]string{"A", "B", "C", "D", "E"}))
    38  		Ω(reporter.Will.Find("C")).Should(BePending())
    39  		Ω(reporter.Will.Find("E")).Should(HaveBeenSkipped())
    40  
    41  		Ω(reporter.Did.Names()).Should(Equal([]string{"A", "B", "C", "D", "E"}))
    42  		Ω(reporter.Did.Find("A")).Should(HavePassed())
    43  		Ω(reporter.Did.Find("B")).Should(HavePassed())
    44  		Ω(reporter.Did.Find("C")).Should(BePending())
    45  		Ω(reporter.Did.Find("D")).Should(HavePassed())
    46  		Ω(reporter.Did.Find("E")).Should(HaveBeenSkipped())
    47  	})
    48  
    49  	It("reports the correct statistics", func() {
    50  		Ω(reporter.End).Should(BeASuiteSummary(NSpecs(5), NPassed(3), NPending(1), NSkipped(1)))
    51  	})
    52  })