Glacier · Gleam Incremental Interactive Unit Testing

Hex Package Hex Docs Licence

Glacier brings incremental interactive unit testing to Gleam. It is meant as a drop-in replacement for gleeunit and depends on a fork of it.

Glacier Logo
Glacier: «A persistent body of dense ice that is constantly moving under its own weight.»

Installation

  1. Run:
gleam remove gleeunit
gleam add glacier --dev
gleam clean
  1. Open YOUR_GlEAM_PROJECT/test/YOUR_GLEAM_PROJECT.gleam and replace import gleeunit with import glacier and gleeunit.main() with glacier.main() (or alias glacier as gleeunit).
  2. If you want to run on Deno 1.40+ open gleam.toml and add:
[javascript.deno]
allow_read = ["./"]
allow_net = ["deno.land"]
allow_run = ["gleam"]

Usage

  1. Run any one of these, of which some are synonyms:
  1. Save gleam module within your projects src or test gleam directory and watch associated tests to re-run.

Notice: On Linux inotify must be installed.

Upgrading Glacier

Make sure to run gleam clean after upgrading Glacier as a dependency.

Improvements over gleeunit

Glacier differs from gleeunit insofar, that it let’s you:

  1. Pass in the glacier flag like so: gleam test -- --glacier, save a gleam module and only related test modules will rerun.
  2. Or pass in a specific unit test modules to rerun, for example: gleam test -- test/my_module_test.gleam.
  3. If gleam test is passed without any ---arguments it behaves the same as gleeunit.
  4. You can still pass in target or runtime flags, such as --target javascript --runtime deno, aka:

Note: gleam test must only be executed from the base project directory!

Testing against Erlang, NodeJS and Deno simultaneously

Run these in 3 terminals side by side:

Requirements & Installation

Requirements

Requires Gleam 1.0.0 or later.

Target specific requirements

Target Erlang

Development and testing only happens on very recent stable Erlang/OTP versions, and thus may or may not run on previous versions.

Depends on fs:

Target JavaScript/NodeJS/Deno

Development and testing only happens on very recent NodeJS LTS versions, and thus may or may not run on previous versions.

Depends on NodeJS:fsPromises.watch or Deno.watchFs:

Documentation

Documentation can be found at https://hexdocs.pm/glacier.

Contributing to Glacier

See CONTRIBUTE.md.

License

Apache 2.0

Search Document