Skip to content

Commit

Permalink
ignore blank skip and focus flags. fixes #780
Browse files Browse the repository at this point in the history
  • Loading branch information
onsi committed Mar 16, 2021
1 parent edb77f8 commit e90a4a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
8 changes: 6 additions & 2 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,14 @@ func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultRepor

// flagFocus implements the -focus flag.
func flagFocus(arg string) {
GinkgoConfig.FocusStrings = append(GinkgoConfig.FocusStrings, arg)
if arg != "" {
GinkgoConfig.FocusStrings = append(GinkgoConfig.FocusStrings, arg)
}
}

// flagSkip implements the -skip flag.
func flagSkip(arg string) {
GinkgoConfig.SkipStrings = append(GinkgoConfig.SkipStrings, arg)
if arg != "" {
GinkgoConfig.SkipStrings = append(GinkgoConfig.SkipStrings, arg)
}
}
9 changes: 9 additions & 0 deletions integration/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ var _ = Describe("Flags Specs", func() {
Ω(output).Should(ContainSubstring("1 Pending"))
Ω(output).Should(ContainSubstring("3 Skipped"))
})

It("should ignore empty skip and focus variables", func() {
session := startGinkgo(pathToTest, "--noColor", "--skip=", "--focus=")
Eventually(session).Should(gexec.Exit(types.GINKGO_FOCUS_EXIT_CODE))
output := string(session.Out.Contents())
Ω(output).Should(ContainSubstring("marshmallow"))
Ω(output).Should(ContainSubstring("chocolate"))
})

It("should run the race detector when told to", func() {
if !raceDetectorSupported() {
Skip("race detection is not supported")
Expand Down

0 comments on commit e90a4a0

Please sign in to comment.