@@ -11,6 +11,7 @@ import Data.Proxy
1111import Data.Typeable
1212import Options.Applicative
1313import System.Directory
14+import System.Environment
1415import System.Exit
1516import System.FilePath ((</>))
1617import System.Info
@@ -103,20 +104,25 @@ runTest path flags = do
103104 normalise (x : xs) = x : normalise xs
104105 normalise [] = []
105106
107+checkNode :: IO ()
108+checkNode = do
109+ nodePath <- findExecutable "node"
110+ nodejsPath <- findExecutable "nodejs"
111+ let node = nodePath <|> nodejsPath
112+ case node of
113+ Nothing -> do
114+ putStrLn "For running the test suite against Node, node must be installed."
115+ exitFailure
116+ Just _ -> return ()
117+
106118main :: IO ()
107119main = do
108− nodePath <- findExecutable "node"
109− nodejsPath <- findExecutable "nodejs"
110− let node = nodePath <|> nodejsPath
111− case node of
112− Nothing -> do
113− putStrLn "For running the test suite against Node, node must be installed."
114− exitFailure
115− Just _ -> do
116− defaultMainWithIngredients ingredients $
120+ args <- getArgs
121+ when ("--node" `elem` args) checkNode
122+ defaultMainWithIngredients ingredients $
117123 askOption $ \(NodeOpt node) ->
118− let (codegen, flags) = if node then (JS, ["--codegen", "node"])
119− else (C , [])
120− in
121− mkGoldenTests (testFamiliesForCodegen codegen)
122− (flags ++ idrisFlags)
124+ let (codegen, flags) = if node then (JS, ["--codegen", "node"])
125+ else (C , [])
126+ in
127+ mkGoldenTests (testFamiliesForCodegen codegen) (flags ++ idrisFlags)
128+