From c5a02ca166b5190ba4eaf533ddef022f3d7c0547 Mon Sep 17 00:00:00 2001 From: Louis Pilfold Date: Tue, 28 Oct 2025 13:45:22 +0000 Subject: [PATCH] v1.7.0 --- CHANGELOG.md | 4 ++++ gleam.toml | 2 +- src/gleeunit/internal/reporting.gleam | 11 +++++++++++ src/gleeunit_ffi.erl | 15 +++++++++++---- src/gleeunit_progress.erl | 2 -- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3149c3..4df43cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## v1.7.0 - 2025-10-28 + +- A custom error is now emitted if Eunit is missing from the Erlang runtime. + ## v1.6.2 - 2025-08-23 - Fixed a bug where the number of passes was reported as the total number of diff --git a/gleam.toml b/gleam.toml index eb1c12c..887e87e 100644 --- a/gleam.toml +++ b/gleam.toml @@ -1,5 +1,5 @@ name = "gleeunit" -version = "1.6.2" +version = "1.7.0" licences = ["Apache-2.0"] description = "A simple test runner for Gleam, using EUnit on Erlang" repository = { type = "github", user = "lpil", repo = "gleeunit" } diff --git a/src/gleeunit/internal/reporting.gleam b/src/gleeunit/internal/reporting.gleam index 3fe25ed..72f766f 100644 --- a/src/gleeunit/internal/reporting.gleam +++ b/src/gleeunit/internal/reporting.gleam @@ -86,6 +86,17 @@ pub fn test_failed( State(..state, failed: state.failed + 1) } +pub fn eunit_missing() -> Result(never, Nil) { + let message = bold(red("Error")) <> ": EUnit libraries not found. + +Your Erlang installation seems to be incomplete. If you installed Erlang using +a package manager ensure that you have installed the full Erlang +distribution instead of a stripped-down version. +" + io.print_error(message) + Error(Nil) +} + fn format_unknown( module: String, function: String, diff --git a/src/gleeunit_ffi.erl b/src/gleeunit_ffi.erl index 29b9553..099098a 100644 --- a/src/gleeunit_ffi.erl +++ b/src/gleeunit_ffi.erl @@ -7,8 +7,15 @@ find_files(Pattern, In) -> lists:map(fun list_to_binary/1, Results). run_eunit(Tests, Options) -> - case eunit:test({timeout, 60, Tests}, Options) of - ok -> {ok, nil}; - error -> {error, nil}; - {error, Term} -> {error, Term} + case code:which(eunit) of + non_existing -> + gleeunit@internal@reporting:eunit_missing(); + + _ -> + case eunit:test({timeout, 60, Tests}, Options) of + ok -> {ok, nil}; + error -> {error, nil}; + {error, Term} -> {error, Term} + end end. + diff --git a/src/gleeunit_progress.erl b/src/gleeunit_progress.erl index 2883008..e6576a5 100644 --- a/src/gleeunit_progress.erl +++ b/src/gleeunit_progress.erl @@ -1,9 +1,7 @@ %% A formatter adapted from Sean Cribb's https://github.com/seancribbs/eunit_formatters -module(gleeunit_progress). --behaviour(eunit_listener). -define(NOTEST, true). --include_lib("eunit/include/eunit.hrl"). %% eunit_listener callbacks -export([