This is an infuriating thing since I have built Hspec-based test suites in which colors all behave normally. But on this project, I cannot get colors to appear when I run all of the test suites at once.
My project.cabal is set up like this:
test-suite unit
type: exitcode-stdio-1.0
main-is: SpecMain.hs
hs-source-dirs: tests/unit
other-modules: WikiSpec
default-language: Haskell2010
ghc-options: -Wall -fno-warn-orphans -threaded
build-depends: base >=4.6
...
test-suite integration
type: exitcode-stdio-1.0
main-is: SpecMain.hs
hs-source-dirs: tests/integration, webapp
other-modules: ApiSpec
default-language: Haskell2010
ghc-options: -Wall -fno-warn-orphans -threaded
build-depends: base >=4.6
...
And then my SpecMain.hs files (identical) contain this:
{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
So, when I run stack test
, all of my tests run, but the output is not colorized. If I run stack build --file-watch --test
, the tests run, but if there is any failure at all then all of the output is colored red. Finally, if I run stack test weblog:unit
or stack test weblog:integration
, then the colors end up exactly as they should be. Headers are white, passing tests are green, failing tests are red, and pending tests are yellow.
When I'm doing active development I tend to depend on stack build --file-watch --test
, but I really need the colors to be right.
Have any of you any idea what is going on, how I can fix this, or what additional information I need to provide?