Skip to content

Add CI and iron out kinks #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 18 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ jobs:
${{ runner.os }}-build-
${{ runner.os }}-

- name: Install global NPM packages
if: matrix.os == 'windows-latest'
run: npm i --global [email protected] spago@next purs-tidy@latest esbuild@latest

- name: Cache PureScript dependencies
uses: actions/cache@v4
with:
Expand All @@ -62,4 +66,4 @@ jobs:
run: npx spago build

- name: Run tests
run: npx spago test
run: npx spago test '--' --no-timeout
19 changes: 12 additions & 7 deletions test/Test/Main.purs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"