on master help sign in
Only install jsdom when testing if it's not present
00afe62Max New
tests/hs/LibTest.hs+4−1
@@ -1,5 +1,7 @@
1module Main where
1module Main where
2
2
3+import Control.Monad (unless)
4+import Data.List (isInfixOf)
3import System.Directory
5import System.Directory
4import System.Exit
6import System.Exit
5import System.FilePath
7import System.FilePath
@@ -12,7 +14,8 @@ main = do
12 top <- getCurrentDirectory
14 top <- getCurrentDirectory
13 let ioScript s = top</>"IO"</>s
15 let ioScript s = top</>"IO"</>s
14 runCmd "git submodule init"
16 runCmd "git submodule init"
17+ out <- readProcess "npm" ["ls", "--parseable"] ""
15− runCmd "npm install jsdom"
18+ unless ("jsdom" `isInfixOf` out) $ runCmd "npm install jsdom"
16 setCurrentDirectory $ top</>"tests"</>"elm"
19 setCurrentDirectory $ top</>"tests"</>"elm"
17 runCmd $ concat [top</>"dist"</>"build"</>"elm"</>"elm --make --only-js --src-dir=" , top</>"automaton", " --src-dir=", top</>"IO", " --src-dir=", top</>"Elm-Test", " Test.elm"]
20 runCmd $ concat [top</>"dist"</>"build"</>"elm"</>"elm --make --only-js --src-dir=" , top</>"automaton", " --src-dir=", top</>"IO", " --src-dir=", top</>"Elm-Test", " Test.elm"]
18 runCmd $ unwords ["cat ", ioScript "prescript.js", Elm.runtime, "build"</>"Test.js", ioScript "handler.js", "> exe.js"]
21 runCmd $ unwords ["cat ", ioScript "prescript.js", Elm.runtime, "build"</>"Test.js", ioScript "handler.js", "> exe.js"]