Skip to content

Commit

Permalink
make formatter suite support being run with overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksails committed Dec 14, 2022
1 parent 00203da commit 7b768db
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion formatter/formatter.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func New(colorMode ColorMode) Formatter {
"coral": getColor("coral", "\x1b[38;5;204m"),
"magenta": getColor("magenta", "\x1b[38;5;13m"),
"green": getColor("green", "\x1b[38;5;10m"),
"dark-green": getColor("darkgreen", "\x1b[38;5;28m"),
"dark-green": getColor("dark-green", "\x1b[38;5;28m"),
"yellow": getColor("yellow", "\x1b[38;5;11m"),
"light-yellow": getColor("light-yellow", "\x1b[38;5;228m"),
"cyan": getColor("cyan", "\x1b[38;5;14m"),
Expand Down
19 changes: 15 additions & 4 deletions formatter/formatter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ var _ = Describe("Formatter", func() {

BeforeEach(func() {
colorMode = formatter.ColorModeTerminal
os.Unsetenv("GINKGO_CLI_COLOR_RED")
os.Unsetenv("GINKGO_CLI_COLOR_ORANGE")
os.Unsetenv("GINKGO_CLI_COLOR_CORAL")
os.Unsetenv("GINKGO_CLI_COLOR_MAGENTA")
os.Unsetenv("GINKGO_CLI_COLOR_GREEN")
os.Unsetenv("GINKGO_CLI_COLOR_DARK_GREEN")
os.Unsetenv("GINKGO_CLI_COLOR_YELLOW")
os.Unsetenv("GINKGO_CLI_COLOR_LIGHT_YELLOW")
os.Unsetenv("GINKGO_CLI_COLOR_CYAN")
os.Unsetenv("GINKGO_CLI_COLOR_LIGHT_GRAY")
os.Unsetenv("GINKGO_CLI_COLOR_BLUE")
})

JustBeforeEach(func() {
Expand Down Expand Up @@ -56,13 +67,13 @@ var _ = Describe("Formatter", func() {
os.Setenv("GINKGO_CLI_COLOR_RED", "\x1b[31m")
})

It("uses the escape codes from the environment variables", func() {
Ω(f.F("{{red}}hi there{{/}}")).Should(Equal("\x1b[31mhi there\x1b[0m"))
})

AfterEach(func() {
os.Unsetenv("GINKGO_CLI_COLOR_RED")
})

It("uses the escape codes from the environment variables", func() {
Ω(f.F("{{red}}hi there{{/}}")).Should(Equal("\x1b[31mhi there\x1b[0m"))
})
})

Describe("NewWithNoColorBool", func() {
Expand Down

0 comments on commit 7b768db

Please sign in to comment.