1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
|
package integration_test
import (
"regexp"
"runtime"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
"github.com/onsi/gomega/gexec"
)
var _ = Describe("Verbose And Succinct Mode", func() {
denoter := "•"
if runtime.GOOS == "windows" {
denoter = "+"
}
Context("when running one package", func() {
BeforeEach(func() {
fm.MountFixture("passing_ginkgo_tests")
})
It("should default to non-succinct mode", func() {
session := startGinkgo(fm.PathTo("passing_ginkgo_tests"), "--no-color")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite"))
})
})
Context("when running more than one package", func() {
BeforeEach(func() {
fm.MountFixture("passing_ginkgo_tests")
fm.MountFixture("more_ginkgo_tests")
})
Context("with no flags set", func() {
It("should default to succinct mode", func() {
session := startGinkgo(fm.TmpDir, "--no-color", "passing_ginkgo_tests", "more_ginkgo_tests")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(MatchRegexp(`\] Passing_ginkgo_tests Suite - 5/5 specs [%s]{5} SUCCESS!`, regexp.QuoteMeta(denoter)))
Ω(output).Should(MatchRegexp(`\] More_ginkgo_tests Suite - 3/3 specs [%s]{3} SUCCESS!`, regexp.QuoteMeta(denoter)))
})
})
Context("with --succinct=false", func() {
It("should not be in succinct mode", func() {
session := startGinkgo(fm.TmpDir, "--no-color", "--succinct=false", "passing_ginkgo_tests", "more_ginkgo_tests")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite"))
Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite"))
})
})
Context("with -v", func() {
It("should not be in succinct mode, but should be verbose", func() {
session := startGinkgo(fm.TmpDir, "--no-color", "-v", "passing_ginkgo_tests", "more_ginkgo_tests")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite"))
Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite"))
Ω(output).Should(ContainSubstring("should proxy strings"))
Ω(output).Should(ContainSubstring("should always pass"))
})
It("should emit output from Bys", func() {
session := startGinkgo(fm.PathTo("passing_ginkgo_tests"), "--no-color", "-v")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(ContainSubstring("emitting one By"))
Ω(output).Should(ContainSubstring("emitting another By"))
})
It("doesn't trigger the race detector", func() {
if !raceDetectorSupported() {
Skip("race detection is not supported")
}
session := startGinkgo(fm.PathTo("passing_ginkgo_tests"), "--no-color", "-v", "-race")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(ContainSubstring("avoiding the race detector"))
})
})
Context("with -vv", func() {
It("should not be in succinct mode, but should be verbose", func() {
session := startGinkgo(fm.TmpDir, "--no-color", "-vv", "passing_ginkgo_tests", "more_ginkgo_tests")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(ContainSubstring("Running Suite: Passing_ginkgo_tests Suite"))
Ω(output).Should(ContainSubstring("Running Suite: More_ginkgo_tests Suite"))
Ω(output).Should(ContainSubstring("should proxy strings"))
Ω(output).Should(ContainSubstring("should always pass"))
})
It("should emit output from Bys", func() {
session := startGinkgo(fm.PathTo("passing_ginkgo_tests"), "--no-color", "-vv")
Eventually(session).Should(gexec.Exit(0))
output := session.Out.Contents()
Ω(output).Should(ContainSubstring("emitting one By"))
Ω(output).Should(ContainSubstring("emitting another By"))
})
})
})
})
|