Skip to content

Commit

Permalink
fix tests by using elm-test-rs
Browse files Browse the repository at this point in the history
the node test runner does not like the hacks we do in
./tests/run-tests.sh. However elm-test-rs does not mind, it seems easier
to switch test runner than to update the hacks for the node test runner.

As an added extra we migrate CI from travis to github actions.
  • Loading branch information
harrysarson committed Apr 5, 2021
1 parent 8e99db3 commit 622de43
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 13 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: CI

on:
push:
branches:
- "main"
pull_request:

jobs:
main:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest]
node-version: [14.x]

env:
ELM_HOME: '${{ github.workspace }}/elm-stuff/elm-home'

steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v1
with:
node-version: "${{ matrix.node-version }}"

- name: Cache node_modules
id: cache-node_modules
uses: actions/cache@v2
with:
path: node_modules
key: node_modules-${{ matrix.os }}-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}

- name: Cache ELM_HOME
uses: actions/cache@v2
with:
path: '${{ env.ELM_HOME }}'
key: elm-${{ matrix.os }}-${{ hashFiles('elm-tooling.json', 'elm/**/elm.json', 'example-*/**/elm.json', 'tests/**/elm.json') }}

- name: Install elm-tooling CLI
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: npm install --no-save elm-tooling

- name: elm-tooling install
run: npx --no-install elm-tooling install

- name: test
run: npx -c ./tests/run-tests.sh
11 changes: 0 additions & 11 deletions .travis.yml

This file was deleted.

6 changes: 6 additions & 0 deletions elm-tooling.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"tools": {
"elm": "0.19.1",
"elm-test-rs": "1.0.0"
}
}
2 changes: 1 addition & 1 deletion tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -o nounset;

#let the caller supply an ELM_TEST binary if desired
if [ -z "${ELM_TEST:-}" ]; then
ELM_TEST=elm-test;
ELM_TEST=elm-test-rs
fi

# since elm/core is treated specially by the compiler (it's always
Expand Down
1 change: 0 additions & 1 deletion tests/tests/Main.elm
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import Task exposing (..)
import Test exposing (..)
import Platform.Cmd exposing (Cmd)
import Json.Decode exposing (Value)
import Test.Runner.Node exposing (run, TestProgram)
import Test.Array as Array
import Test.Basics as Basics
import Test.Bitwise as Bitwise
Expand Down

0 comments on commit 622de43

Please sign in to comment.