...

Source file src/github.com/onsi/ginkgo/v2/integration/decorations_test.go

Documentation: github.com/onsi/ginkgo/v2/integration

     1  package integration_test
     2  
     3  import (
     4  	. "github.com/onsi/ginkgo/v2"
     5  	"github.com/onsi/ginkgo/v2/types"
     6  	. "github.com/onsi/gomega"
     7  	"github.com/onsi/gomega/gbytes"
     8  	"github.com/onsi/gomega/gexec"
     9  )
    10  
    11  var _ = Describe("Decorations", func() {
    12  	BeforeEach(func() {
    13  		fm.MountFixture("decorations")
    14  	})
    15  
    16  	It("processes the Offset, Focus and Pending decorations", func() {
    17  		session := startGinkgo(fm.PathTo("decorations", "offset_focus_pending"), "-vv", "--no-color")
    18  		Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE))
    19  
    20  		out := string(session.Out.Contents())
    21  		Ω(out).Should(MatchRegexp(
    22  			`P \[PENDING\]
    23  some decorated specs
    24  .*offset_focus_pending_fixture_suite_test.go:\d+
    25    pending it`,
    26  		))
    27  
    28  		Ω(out).ShouldNot(ContainSubstring("never_see_this_file"))
    29  	})
    30  
    31  	It("processes the FlakeAttempts and the MustPassRepeatedly decorations", func() {
    32  		session := startGinkgo(fm.PathTo("decorations", "flaky_repeated"), "-vv", "--no-color")
    33  		Eventually(session).Should(gexec.Exit(1))
    34  
    35  		Ω(session).Should(gbytes.Say("Attempt #1 Failed.  Retrying"))
    36  		Ω(session).Should(gbytes.Say("Attempt #2 Failed.  Retrying"))
    37  
    38  		Ω(session).Should(gbytes.Say("Attempt #1 Passed.  Repeating"))
    39  		Ω(session).Should(gbytes.Say("Attempt #2 Passed.  Repeating"))
    40  		Ω(session).Should(gbytes.Say("failed on attempt #3"))
    41  	})
    42  
    43  	It("exits with a clear error if decorations are misconfigured - focus and pending error", func() {
    44  		session := startGinkgo(fm.PathTo("decorations", "invalid_decorations_focused_pending"), "-v", "--no-color")
    45  		Eventually(session).Should(gexec.Exit(1))
    46  		Ω(session).Should(gbytes.Say("Invalid Combination of Decorators: Focused and Pending"))
    47  	})
    48  
    49  	It("exits with a clear error if decorations are misconfigured - flakeattempts and mustpassrepeatedly error", func() {
    50  		session := startGinkgo(fm.PathTo("decorations", "invalid_decorations_flakeattempts_mustpassrepeatedly"), "-v", "--no-color")
    51  		Eventually(session).Should(gexec.Exit(1))
    52  		Ω(session).Should(gbytes.Say("Invalid Combination of Decorators: FlakeAttempts and MustPassRepeatedly"))
    53  	})
    54  })
    55  

View as plain text