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: build-depends:
, HUnit , HUnit
, aeson , aeson
, aeson-pretty
, base , base
, bytestring , bytestring
, dc-api , dc-api

View File

@ -4,12 +4,14 @@ import Data.List
fixtureReplMacro :: String -> IO String fixtureReplMacro :: String -> IO String
fixtureReplMacro module_ = do fixtureReplMacro module_ = do
return $ unlines 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 Harness.Logging",
"import System.Environment",
":m + *SpecHook *" ++ module_, ":m + *SpecHook *" ++ module_,
"logger = Logger mempty", "Right mode <- fmap lookupTestingMode getEnvironment",
"mode <- setupTestingMode", "te <- setupTestEnvironment mode (Logger $ BS.putStrLn . encodePretty . fromLoggableMessage)",
"te <- setupTestEnvironment mode logger",
"te", "te",
"putStrLn \"Now do: \\\"cleanup <- fixtureRepl <fixture name> te\\\"\"" "putStrLn \"Now do: \\\"cleanup <- fixtureRepl <fixture name> te\\\"\""
] ]