Glacier · Contribution Guide
This package heavily depends on a gleeunit fork called glacier_gleeunit!
Improving Glacier
git clone https://github.com/inoas/glacier.git
cd glacier
See all open issues on GitHub if you want to help out.
How does it work?
gleam testpasses throughglacier.main()and simply executesgleeunit.main()as if gleeunit was used directly.gleam test -- test_module_a test_module_bpasses throughglacier.main()and executesgleeunit.test_modules(modules_list)wheremodules_listis["foo", "bar"]. The given modules are checked if they exist as either.gleamor.erltest module files and then gleeunit runs these test modules.gleam test -- --glacierentersglacier.main()and starts a file watcher: Upon changes in module files in./testit just passes those through asgleam test -- changed_test_module(so re-saving test files executes the single test), and if a module file in./srcgot changed it parses that changed module file for any imported modules and puts the module and all chained imported modules in a distinct list of modules that should be tested. Then all test module files are read and imports of those are gathered one by one and cross matched against that list. The result is a list of test modules that need to be run, which then gets done by executing a shell call similar togleam test -- detected_test_module_a detected_test_module_b detected_test_module_c etc, aka jump to step2.
Demo for target Erlang
# Traditional test runs
gleam test --target erlang
gleam test --target erlang -- test/glacier_demo/glacier_demo_module_a_test.gleam
# Incremental interactive test
gleam test --target erlang -- --glacier
# Re-save ./src/glacier_demo/glacier_demo_module_a.gleam
Demo for target JavaScript on NodeJS
# Traditional test runs
gleam test --target javascript --runtime node
gleam test --target javascript --runtime node -- test/glacier_demo/glacier_demo_module_a_test.gleam
# Incremental interactive test
gleam test --target javascript --runtime node -- --glacier
# Re-save ./src/glacier_demo/glacier_demo_module_a.gleam
Notice: You may omit --runtime node as it is currently set as the default runtime for target javascript.
Demo for target JavaScript on Deno
# Traditional test runs
gleam test --target javascript --runtime deno
gleam test --target javascript --runtime deno -- test/glacier_demo/glacier_demo_module_a_test.gleam
# Incremental interactive test
gleam test --target javascript --runtime deno -- --glacier
# Re-save ./src/glacier_demo/glacier_demo_module_a.gleam
Privileges required for Deno
Do not forget to edit gleam.toml to add deno privileges:
[javascript.deno]
allow_read = ["./"]
allow_net = ["deno.land"]
allow_run = ["gleam"]
Caveats
In line with gleam module name requirements:
./srcand./testsource files with white spaces will not pass detection.- Behavior towards
./srcand./testsource files with non-alphanumeric characters is not tested, and generally unsupported.