From 8325c035000e06b4a12b1051d0451c74c98966e5 Mon Sep 17 00:00:00 2001 From: Tom Harding Date: Thu, 22 Dec 2022 11:25:28 +0000 Subject: [PATCH] Update the fixture repl macro PR-URL: https://github.com/hasura/graphql-engine-mono/pull/7366 GitOrigin-RevId: f34a42c4dfd2dc257ffe39f4a0db12beb2630629 --- server/lib/api-tests/api-tests.cabal | 1 + server/lib/api-tests/ghci/fixtureRepl.ghci | 10 ++++++---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/server/lib/api-tests/api-tests.cabal b/server/lib/api-tests/api-tests.cabal index 7051763a8a8..8006d8754a5 100644 --- a/server/lib/api-tests/api-tests.cabal +++ b/server/lib/api-tests/api-tests.cabal @@ -35,6 +35,7 @@ library build-depends: , HUnit , aeson + , aeson-pretty , base , bytestring , dc-api diff --git a/server/lib/api-tests/ghci/fixtureRepl.ghci b/server/lib/api-tests/ghci/fixtureRepl.ghci index 2b91d1e923d..68d62c1867d 100644 --- a/server/lib/api-tests/ghci/fixtureRepl.ghci +++ b/server/lib/api-tests/ghci/fixtureRepl.ghci @@ -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 te\\\"\"" ]