vouch

CI

image

A gleeunit compatible test runner for Gleam.

Install

gleam add --dev vouch
 // test/my_project_test.gleam
-import gleeunit
+import vouch

 pub fn main() {
-  gleeunit.main()
+  vouch.main()
 }

Tests are discovered by the same heuristics that gleeunit uses, with tests as module_tests.gleam, and the usual conventions.

Assertions: use let assert

Use let assert, or another assert based assertion library to assert. Vouch formats assert failures in the most human-friendly way I could manage.

Example Usage

gleam test
gleam test -- --filter=parser
gleam test -- --test-name-filter=parser # alias for --filter for startest compatibility ( zed extension convention )
gleam test -- --format=json
gleam test -- --format=teamcity
gleam test -- --junit=report.xml
gleam test -- --timeout=1000            # Erlang target only
gleam test -- --parallel                # Erlang target only
gleam test -- --color=never             # console colour: auto | always | never
gleam run -m vouch -- watch             # rerun the suite on file change

Watch mode

gleam run -m vouch -- watch [options] reruns the suite whenever there are changes in src/, test/, or gleam.toml.

Press q then Enter to quit. It’s a bit awkward, but Ctrl+C is captured by the BEAM and I couldn’t get it to work properly and I don’t have enough environments to test the specifics for trying to overcome that issue.

Outcomes

OutcomeMeaningExit code contribution
passran without panic0
failassert/panic/crash/timeout1
todohit todo in code under test1 — unimplemented is still not done
skiptodo within test function0

Target differences

Erlang target supports --parallel and --timeout=n

Deno needs permissions in your project’s gleam.toml. You need allow_read for discovery and source quoting. you need allow_write if you use --junit for XML report output You need allow_env for detecting NO_COLOR environemnt variable

[javascript.deno]
allow_read = ["gleam.toml", "src", "test", "build"]
allow_write = ["."]
allow_env = ["NO_COLOR"]
Search Document