Disable hspec colored output in servant-swagger doctests

Colored output is the default since hspec 2.9.5.

This causes CI failures due to terminal escaping characters when running
the doctests on GitHub Actions.
This commit is contained in:
Gaël Deest 2022-04-19 10:46:39 +02:00
parent c19ed0fb92
commit 78280dc267
2 changed files with 4 additions and 0 deletions

View file

@ -55,6 +55,7 @@ import Servant.Swagger.Internal.Orphans ()
-- >>> import Data.Typeable -- >>> import Data.Typeable
-- >>> import GHC.Generics -- >>> import GHC.Generics
-- >>> import Servant.API -- >>> import Servant.API
-- >>> import System.Environment
-- >>> import Test.Hspec -- >>> import Test.Hspec
-- >>> import Test.QuickCheck -- >>> import Test.QuickCheck
-- >>> import qualified Data.ByteString.Lazy.Char8 as BSL8 -- >>> import qualified Data.ByteString.Lazy.Char8 as BSL8
@ -64,6 +65,7 @@ import Servant.Swagger.Internal.Orphans ()
-- >>> :set -XGeneralizedNewtypeDeriving -- >>> :set -XGeneralizedNewtypeDeriving
-- >>> :set -XOverloadedStrings -- >>> :set -XOverloadedStrings
-- >>> :set -XTypeOperators -- >>> :set -XTypeOperators
-- >>> setEnv "HSPEC_COLOR" "no"
-- >>> data User = User { name :: String, age :: Int } deriving (Show, Generic, Typeable) -- >>> data User = User { name :: String, age :: Int } deriving (Show, Generic, Typeable)
-- >>> newtype UserId = UserId Integer deriving (Show, Generic, Typeable, ToJSON) -- >>> newtype UserId = UserId Integer deriving (Show, Generic, Typeable, ToJSON)
-- >>> instance ToJSON User -- >>> instance ToJSON User

View file

@ -29,10 +29,12 @@ import Servant.Swagger.Internal.TypeLevel
-- >>> import Control.Applicative -- >>> import Control.Applicative
-- >>> import GHC.Generics -- >>> import GHC.Generics
-- >>> import Test.QuickCheck -- >>> import Test.QuickCheck
-- >>> import System.Environment (setEnv)
-- >>> :set -XDeriveGeneric -- >>> :set -XDeriveGeneric
-- >>> :set -XGeneralizedNewtypeDeriving -- >>> :set -XGeneralizedNewtypeDeriving
-- >>> :set -XDataKinds -- >>> :set -XDataKinds
-- >>> :set -XTypeOperators -- >>> :set -XTypeOperators
-- >>> setEnv "HSPEC_COLOR" "no"
-- | Verify that every type used with @'JSON'@ content type in a servant API -- | Verify that every type used with @'JSON'@ content type in a servant API
-- has compatible @'ToJSON'@ and @'ToSchema'@ instances using @'validateToJSON'@. -- has compatible @'ToJSON'@ and @'ToSchema'@ instances using @'validateToJSON'@.