fix(gate): show which UI test failed instead of swallowing it
The ui-unit-tests stage piped vitest through `tail -4`, which cut off the failure block. A red gate reported "1 failed | 999 passed" and nothing else — no file, no test name, no assertion — so the failure could not be diagnosed after the run. Success still prints the quiet 4-line summary; failure now dumps the full log and keeps it on disk so a scrolled-off terminal isn't the end of it. Verified both paths: green run unchanged, and a deliberately failing spec now surfaces its file, test name, assertion and line number. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
c788dff42d
commit
d75963de10
+14
-1
@@ -75,7 +75,20 @@ fi
|
||||
|
||||
# ── Stage 2: frontend ────────────────────────────────────────────────
|
||||
stage "ui-type-check" bash -c 'cd neode-ui && npm run --silent type-check'
|
||||
stage "ui-unit-tests" bash -c 'cd neode-ui && npx vitest run --silent 2>&1 | tail -4; exit ${PIPESTATUS[0]}'
|
||||
# A red vitest run must name the failing test. `| tail -4` used to swallow the
|
||||
# failure block, so the gate reported only "1 failed" and nothing else —
|
||||
# undiagnosable after the fact. Quiet 4-line summary on success, full log on
|
||||
# failure (kept on disk so a scrolled-off terminal is not the end of it).
|
||||
ui_unit_tests() {
|
||||
local log; log=$(mktemp -t vitest-gate.XXXXXX.log)
|
||||
if ( cd neode-ui && npx vitest run --silent ) >"$log" 2>&1; then
|
||||
tail -4 "$log"; rm -f "$log"; return 0
|
||||
fi
|
||||
echo "──── vitest FAILED — full log kept at $log ────"
|
||||
cat "$log"
|
||||
return 1
|
||||
}
|
||||
stage "ui-unit-tests" ui_unit_tests
|
||||
|
||||
if [[ $WITH_BUILD -eq 1 ]]; then
|
||||
# npm run build can fail silently (vue-tsc EACCES burned us before) —
|
||||
|
||||
Reference in New Issue
Block a user