Skip to content

Commit

Permalink
Merge pull request #4613 from melted/fix_node_check
Browse files Browse the repository at this point in the history
Only check for Node when required
  • Loading branch information
melted committed Dec 11, 2018
2 parents 0cf1728 + 6c52e1b commit 2dad1eb
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions test/TestRun.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import Data.Proxy
import Data.Typeable
import Options.Applicative
import System.Directory
import System.Environment
import System.Exit
import System.FilePath ((</>))
import System.Info
Expand Down Expand Up @@ -103,20 +104,25 @@ runTest path flags = do
normalise (x : xs) = x : normalise xs
normalise [] = []

checkNode :: IO ()
checkNode = do
nodePath <- findExecutable "node"
nodejsPath <- findExecutable "nodejs"
let node = nodePath <|> nodejsPath
case node of
Nothing -> do
putStrLn "For running the test suite against Node, node must be installed."
exitFailure
Just _ -> return ()

main :: IO ()
main = do
nodePath <- findExecutable "node"
nodejsPath <- findExecutable "nodejs"
let node = nodePath <|> nodejsPath
case node of
Nothing -> do
putStrLn "For running the test suite against Node, node must be installed."
exitFailure
Just _ -> do
defaultMainWithIngredients ingredients $
args <- getArgs
when ("--node" `elem` args) checkNode
defaultMainWithIngredients ingredients $
askOption $ \(NodeOpt node) ->
let (codegen, flags) = if node then (JS, ["--codegen", "node"])
else (C , [])
in
mkGoldenTests (testFamiliesForCodegen codegen)
(flags ++ idrisFlags)
let (codegen, flags) = if node then (JS, ["--codegen", "node"])
else (C , [])
in
mkGoldenTests (testFamiliesForCodegen codegen) (flags ++ idrisFlags)

0 comments on commit 2dad1eb

Please sign in to comment.