@@ -8,12 +8,13 @@ import Data.String (trim)
8
8
import Data.String.Regex (replace ) as Regex
9
9
import Data.String.Regex.Flags (global ) as Regex
10
10
import Data.String.Regex.Unsafe (unsafeRegex ) as Regex
11
- import Debug (traceM )
12
11
import Effect (Effect )
13
- import Node.ChildProcess.Types (Exit (..), pipe )
12
+ import Node.ChildProcess.Types (Exit (..), pipe , inherit )
14
13
import Node.Encoding (Encoding (..))
15
14
import Node.FS.Aff as FS
16
15
import Node.Library.Execa (execa )
16
+ import Node.Platform (Platform (..))
17
+ import Node.Process (platform )
17
18
import Test.Spec as Spec
18
19
import Test.Spec.Assertions (fail )
19
20
import Test.Spec.Reporter (consoleReporter )
@@ -36,7 +37,7 @@ main = runSpecAndExitProcess [consoleReporter] $
36
37
runTest [" --example" , " gotham city" ] >>= shouldFailWith " filter-spaces.txt"
37
38
38
39
Spec .it " can filter by FULL test name" do
39
- runTest [" --example" , " gotham city is a dark" ] >>= shouldFailWith " filter-spaces .txt"
40
+ runTest [" --example" , " gotham city is a dark" ] >>= shouldFailWith " filter-full-name .txt"
40
41
41
42
Spec .describe " --example-matches" do
42
43
Spec .it " can filter by test name by regex" do
@@ -74,10 +75,10 @@ main = runSpecAndExitProcess [consoleReporter] $
74
75
75
76
where
76
77
runTest args' = do
77
- let opts = _ { cwd = Just " test-fixtures/project" , stdin = Just pipe , stdout = Just pipe, stderr = Just pipe }
78
- args = [" spago " , " test" , " --" ] <> args'
79
- execa " npx " [ " spago " , " build" ] opts >>= _.getResult >>= shouldSucceed
80
- execa " npx " args opts >>= _.getResult
78
+ let opts = _ { cwd = Just " test-fixtures/project" , stdin = Just inherit , stdout = Just pipe, stderr = Just pipe }
79
+ args = [" test" , " --" ] <> args'
80
+ execa spagoCmd [ " build" ] opts >>= _.getResult >>= shouldSucceed
81
+ execa spagoCmd args opts >>= _.getResult
81
82
82
83
nukeLastResults =
83
84
FS .rm' " test-fixtures/project/.spec-results"
@@ -147,3 +148,7 @@ main = runSpecAndExitProcess [consoleReporter] $
147
148
148
149
stripColors = Regex .replace colorRegex " "
149
150
colorRegex = Regex .unsafeRegex " \x1B \\ [([0-9]|;)+m" Regex .global
151
+
152
+ spagoCmd = case platform of
153
+ Just Win32 -> " spago.ps1"
154
+ _ -> " spago"
0 commit comments