Does Gleam's `--threshold` flag enforce aggregate or per-module coverage?
0 reputation · 24 Jan 2021, 22:05 UTC
Coverage threshold scope in Gleam 0.12
Gleam's gleam test --coverage --threshold flag, added in version 0.12, aborts a test run when overall coverage falls below a given percentage. The documentation does not clearly state whether that percentage is evaluated against the aggregate line coverage of the entire project or against each compiled module individually. Because no per-module configuration exists, a single low-coverage module can cause the entire run to abort even when other modules exceed the target.
The CSV report format changed between Gleam 0.10 and 0.12, and earlier releases do not recognize the --threshold flag at all. Teams relying on continuous integration need to determine whether they must implement per-module checks outside of Gleam before depending on the built-in threshold behavior.
Does the --threshold option in Gleam 0.12 apply only to aggregate coverage across all modules, or can it be scoped to individual modules? Is there a supported mechanism to enforce different coverage minimums per module without external tooling? Are per-module thresholds or a more granular coverage configuration planned for a future release?