Skip to content

Commit 1e36ecd

Browse files
authored
Add CI and iron out kinks (#1)
1 parent 0053d3d commit 1e36ecd

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ jobs:
4444
${{ runner.os }}-build-
4545
${{ runner.os }}-
4646
47+
- name: Install global NPM packages
48+
if: matrix.os == 'windows-latest'
49+
run: npm i --global [email protected] spago@next purs-tidy@latest esbuild@latest
50+
4751
- name: Cache PureScript dependencies
4852
uses: actions/cache@v4
4953
with:
@@ -62,4 +66,4 @@ jobs:
6266
run: npx spago build
6367

6468
- name: Run tests
65-
run: npx spago test
69+
run: npx spago test '--' --no-timeout

test/Test/Main.purs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@ import Data.String (trim)
88
import Data.String.Regex (replace) as Regex
99
import Data.String.Regex.Flags (global) as Regex
1010
import Data.String.Regex.Unsafe (unsafeRegex) as Regex
11-
import Debug (traceM)
1211
import Effect (Effect)
13-
import Node.ChildProcess.Types (Exit(..), pipe)
12+
import Node.ChildProcess.Types (Exit(..), pipe, inherit)
1413
import Node.Encoding (Encoding(..))
1514
import Node.FS.Aff as FS
1615
import Node.Library.Execa (execa)
16+
import Node.Platform (Platform(..))
17+
import Node.Process (platform)
1718
import Test.Spec as Spec
1819
import Test.Spec.Assertions (fail)
1920
import Test.Spec.Reporter (consoleReporter)
@@ -36,7 +37,7 @@ main = runSpecAndExitProcess [consoleReporter] $
3637
runTest ["--example", "gotham city"] >>= shouldFailWith "filter-spaces.txt"
3738

3839
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"
4041

4142
Spec.describe "--example-matches" do
4243
Spec.it "can filter by test name by regex" do
@@ -74,10 +75,10 @@ main = runSpecAndExitProcess [consoleReporter] $
7475

7576
where
7677
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
8182

8283
nukeLastResults =
8384
FS.rm' "test-fixtures/project/.spec-results"
@@ -147,3 +148,7 @@ main = runSpecAndExitProcess [consoleReporter] $
147148

148149
stripColors = Regex.replace colorRegex ""
149150
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

Comments
 (0)