Skip to content

Commit 94f7a00

Browse files
committed
test: run-all echoes a failing suite's assertion lines
A matrix-only failure (Windows render-diff, 4 tests) reports bare counts in CI with no way to see which assertions broke — the runner captures suite output and discards it. On failure, print the suite's ✘/FAIL lines (capped).
1 parent e0061b4 commit 94f7a00

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/run-all.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,16 @@ const suites = allFiles.filter(shouldRun).map(file => ({
9595
* formats used across suites; `glyphFallback` additionally counts per-test
9696
* ✔/PASS/✓ marks (success path only — noisy on crash output).
9797
*/
98+
/**
99+
* Echo a failing suite's individual failure lines so CI logs name the exact
100+
* assertions — without this, a matrix-only failure (e.g. Windows) reports
101+
* counts with no way to see what broke.
102+
*/
103+
function printFailureLines(output: string, cap = 20): void {
104+
const lines = output.split("\n").filter(l => /|FAIL/.test(l)).slice(0, cap);
105+
for (const line of lines) console.log(` ${line.trim()}`);
106+
}
107+
98108
function parseCounts(output: string, glyphFallback: boolean): { passed: number; failed: number } {
99109
const totalMatch = output.match(/Total:\s*(\d+)\s*Passed:\s*(\d+)\s*Failed:\s*(\d+)/i);
100110
if (totalMatch) return { passed: parseInt(totalMatch[2]), failed: parseInt(totalMatch[3]) };
@@ -155,6 +165,7 @@ for (const suite of suites) {
155165

156166
if (failed > 0) {
157167
console.log(` \x1b[31m${passed} passed, ${failed} failed\x1b[0m (${duration}ms)`);
168+
printFailureLines(output);
158169
} else {
159170
console.log(` \x1b[32m${passed} passed\x1b[0m (${duration}ms)`);
160171
}
@@ -182,6 +193,7 @@ for (const suite of suites) {
182193
totalFailed += failed || 1;
183194
results.push({ name: suite.name, passed, failed, duration });
184195
console.log(` \x1b[31m${passed} passed, ${failed} failed\x1b[0m (${duration}ms)`);
196+
printFailureLines(output);
185197
}
186198
}
187199
}

0 commit comments

Comments
 (0)