graphql-engine/server/lib/api-tests/ghci/fixtureRepl.ghci
Daniel Harvey 52317930fe Fix make ghcid-api-tests
PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7738
GitOrigin-RevId: 1576bfb51b20cdc8a67924533e4da03ec2f1f3af
2023-02-01 12:34:59 +00:00

21 lines
687 B
Plaintext

import Data.List qualified as List
:{
fixtureReplMacro :: String -> IO String
fixtureReplMacro module_ = do
return $ List.unlines
[ "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_,
"Right mode <- fmap lookupTestingMode getEnvironment",
"te <- setupTestEnvironment mode (Logger $ BS.putStrLn . encodePretty . fromLoggableMessage)",
"te",
"putStrLn \"Now do: \\\"cleanup <- fixtureRepl <fixture name> te\\\"\""
]
:}
:def fixtureRepl fixtureReplMacro