From 73a705efe4005dc491e7a055e1104f4c0ed28f95 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Tue, 21 Jul 2026 07:19:47 +0100 Subject: [PATCH] fix(tests): e2e.sh discarded all mix test output, making CI undebuggable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `tests/e2e.sh` judged the Elixir suite with: mix test --trace 2>&1 | tail -5 | grep -q "0 failures" The pipe threw the entire run away. When the suite failed, CI printed exactly one line: FAIL: Elixir unit tests Results: PASS=7 FAIL=1 SKIP=0 No failing test name, no assertion, no stacktrace. The `E2E — Elixir Scanner Pipeline` job has been red on main with literally nothing to diagnose from. Now: capture the run to a log, judge it by mix's own exit status (mix already exits non-zero on failure — the `grep "0 failures"` was a weaker proxy that also mis-reports a crash that never reaches the summary line), and echo the tail of the output when it fails. Verified by stubbing a failing `mix` and confirming the diagnostic surfaces: FAIL: Elixir unit tests --- mix test output (tail 120) --- 1) test foo (Hypatia.ReflexiveTest) ** (exit) no process --- end mix test output --- bash -n clean; shellcheck reports nothing on the new block. What this immediately reveals (reproduced locally, Elixir 1.18.3/OTP 27): `mix test` = 1398 tests, 20 failures, ALL in test/reflexive_test.exs, all `GenServer.call(Hypatia.Supervisor, {:terminate_child, ...})` -> "no process ... possibly because its application isn't started". Running that file ALONE gives 16 tests, 0 failures — so it is a test-isolation defect, not a product bug. Filed separately; this commit only makes it visible. Co-Authored-By: Claude Opus 4.8 --- tests/e2e.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/e2e.sh b/tests/e2e.sh index 8153ecd9..4b1ef6c9 100755 --- a/tests/e2e.sh +++ b/tests/e2e.sh @@ -114,12 +114,24 @@ if $HAS_ELIXIR; then fi fi - # Unit tests - if mix test --trace 2>&1 | tail -5 | grep -q "0 failures"; then + # Unit tests. + # + # Previously this was `mix test --trace 2>&1 | tail -5 | grep -q "0 failures"`, + # which DISCARDED the entire test output. A CI failure therefore reported + # exactly one line — "FAIL: Elixir unit tests" — with no failing test name, + # no assertion, no stacktrace, making the red job impossible to diagnose + # from CI. Capture the run, judge it by mix's own exit status, and echo the + # output when it fails. + _mix_log="${TMPDIR:-/tmp}/hypatia-mix-test.$$.log" + if mix test --trace >"$_mix_log" 2>&1; then pass "Elixir unit tests pass" else fail_test "Elixir unit tests" + echo "--- mix test output (tail 120) ---" + tail -120 "$_mix_log" + echo "--- end mix test output ---" fi + rm -f "$_mix_log" echo "" fi