Gren Effectful Test Runner
Run Gren integration tests that depend on the actual results of tasks.
See the full API on the package site.
Example
module Main exposing (main)
import Task
import Test exposing (describe, test)
import Expect
import Test.Runner.Effectful exposing (Program, await, run)
import Time
main : Program
main = run
[ await Time.now "test that depends on result of a task" <| \now ->
describe "nest a full test suite if you want"
[ test "test that fails" <| \_ ->
Expect.equal (Time.millisToPosix 0) now
]
, await (Task.fail "oops") "task that fails" <| \_ ->
test "the suite will fail and this test will never run" <| \_ ->
Expect.equal True True
, expectError (Task.fail "failure") "task that you expect to fail" <| \error ->
test "make assertions on errors" <| \_ ->
Expect.equal "failure" error
]
Quick Start
Create a directory for your tests and initialize a gren program targeting node:
mkdir tests
cd tests
gren init --platform=node
Install the necessary packages:
gren package install gren-lang/test
gren package install blaix/gren-effectful-tests-node
Create a src/Main.gren
with your tests.
See the example above or the example in the repo.
Then compile and run your tests:
gren make src/Main.gren
node app
Contact
Found a problem? Need some help? You can open an issue, find me on mastodon, or on the Gren Discord.