Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -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" }
Expand Down
11 changes: 11 additions & 0 deletions src/gleeunit/internal/reporting.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
15 changes: 11 additions & 4 deletions src/gleeunit_ffi.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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.

2 changes: 0 additions & 2 deletions src/gleeunit_progress.erl
Original file line number Diff line number Diff line change
@@ -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([
Expand Down