Update the fixture repl macro

PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7366
GitOrigin-RevId: f34a42c4dfd2dc257ffe39f4a0db12beb2630629
This commit is contained in:
Tom Harding 2022-12-22 11:25:28 +00:00 committed by hasura-bot
parent 73e333a412
commit 8325c03500
2 changed files with 7 additions and 4 deletions

View File

@ -35,6 +35,7 @@ library
build-depends:
, HUnit
, aeson
, aeson-pretty
, base
, bytestring
, dc-api

View File

@ -4,12 +4,14 @@ import Data.List
fixtureReplMacro :: String -> IO String
fixtureReplMacro module_ = do
return $ unlines
[ "import Harness.Test.Fixture",
[ "import Data.Aeson.Encode.Pretty (encodePretty)",
"import Data.ByteString.Lazy.Char8 qualified as BS",
"import Harness.Test.Fixture",
"import Harness.Logging",
"import System.Environment",
":m + *SpecHook *" ++ module_,
"logger = Logger mempty",
"mode <- setupTestingMode",
"te <- setupTestEnvironment mode logger",
"Right mode <- fmap lookupTestingMode getEnvironment",
"te <- setupTestEnvironment mode (Logger $ BS.putStrLn . encodePretty . fromLoggableMessage)",
"te",
"putStrLn \"Now do: \\\"cleanup <- fixtureRepl <fixture name> te\\\"\""
]