From e90a4a038c538a8ef989b871b5851a5b116eb9a1 Mon Sep 17 00:00:00 2001 From: Onsi Fakhouri Date: Tue, 16 Mar 2021 06:40:52 -0600 Subject: [PATCH] ignore blank skip and focus flags. fixes #780 --- config/config.go | 8 ++++++-- integration/flags_test.go | 9 +++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/config/config.go b/config/config.go index 8a2479824..33ac378c5 100644 --- a/config/config.go +++ b/config/config.go @@ -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) + } } diff --git a/integration/flags_test.go b/integration/flags_test.go index 20b049205..fb7b38a29 100644 --- a/integration/flags_test.go +++ b/integration/flags_test.go @@ -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")