diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f23d5da..2f7f53c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,10 @@ jobs: ${{ runner.os }}-build- ${{ runner.os }}- + - name: Install global NPM packages + if: matrix.os == 'windows-latest' + run: npm i --global purescript@0.15.15 spago@next purs-tidy@latest esbuild@latest + - name: Cache PureScript dependencies uses: actions/cache@v4 with: @@ -62,4 +66,4 @@ jobs: run: npx spago build - name: Run tests - run: npx spago test + run: npx spago test '--' --no-timeout diff --git a/test/Test/Main.purs b/test/Test/Main.purs index a3df03a..233d9ee 100644 --- a/test/Test/Main.purs +++ b/test/Test/Main.purs @@ -8,12 +8,13 @@ import Data.String (trim) import Data.String.Regex (replace) as Regex import Data.String.Regex.Flags (global) as Regex import Data.String.Regex.Unsafe (unsafeRegex) as Regex -import Debug (traceM) import Effect (Effect) -import Node.ChildProcess.Types (Exit(..), pipe) +import Node.ChildProcess.Types (Exit(..), pipe, inherit) import Node.Encoding (Encoding(..)) import Node.FS.Aff as FS import Node.Library.Execa (execa) +import Node.Platform (Platform(..)) +import Node.Process (platform) import Test.Spec as Spec import Test.Spec.Assertions (fail) import Test.Spec.Reporter (consoleReporter) @@ -36,7 +37,7 @@ main = runSpecAndExitProcess [consoleReporter] $ runTest ["--example", "gotham city"] >>= shouldFailWith "filter-spaces.txt" Spec.it "can filter by FULL test name" do - runTest ["--example", "gotham city is a dark"] >>= shouldFailWith "filter-spaces.txt" + runTest ["--example", "gotham city is a dark"] >>= shouldFailWith "filter-full-name.txt" Spec.describe "--example-matches" do Spec.it "can filter by test name by regex" do @@ -74,10 +75,10 @@ main = runSpecAndExitProcess [consoleReporter] $ where runTest args' = do - let opts = _ { cwd = Just "test-fixtures/project", stdin = Just pipe, stdout = Just pipe, stderr = Just pipe } - args = ["spago", "test", "--"] <> args' - execa "npx" ["spago", "build"] opts >>= _.getResult >>= shouldSucceed - execa "npx" args opts >>= _.getResult + let opts = _ { cwd = Just "test-fixtures/project", stdin = Just inherit, stdout = Just pipe, stderr = Just pipe } + args = ["test", "--"] <> args' + execa spagoCmd ["build"] opts >>= _.getResult >>= shouldSucceed + execa spagoCmd args opts >>= _.getResult nukeLastResults = FS.rm' "test-fixtures/project/.spec-results" @@ -147,3 +148,7 @@ main = runSpecAndExitProcess [consoleReporter] $ stripColors = Regex.replace colorRegex "" colorRegex = Regex.unsafeRegex "\x1B\\[([0-9]|;)+m" Regex.global + + spagoCmd = case platform of + Just Win32 -> "spago.ps1" + _ -> "spago"