Skip to content

The HTML report says a test failed but never why #1251

Description

@Chemaclass

Problem

--report-html lists test name, status and duration, and nothing else. For the same run, the Markdown report gives:

## Failures

### Bad

`cmp_test.sh:2`

✗ Failed: Bad
Expected 'want'
but got 'got'
at cmp_test.sh:2

while the HTML report gives:

Bad     failed   15
Good    passed   11

JUnit carries the message in <failure>, JSON in .message, TAP in its YAML block, Markdown in a fenced block. HTML is the only format that drops it — and it is the one people open in a browser precisely to find out what broke, so it is the one where the omission costs most.

Proposal

Add a Failures section after the per-file tables, shaped like the Markdown report's: test name, file:line, and the message in a <pre> block. Only for runs that have failures, so a green report does not grow an empty heading.

The message is user text and goes through the same escaping as #1249, since a failure comparing <b>want</b> against <i>got</i> would otherwise inject markup exactly as a title did.

Note on the escaping

The per-test rows are escaped in a single awk pass because they are numerous and single-line. Failure messages are few and multi-line, so they use a small __html_escape helper — one fork per failure at report time. Same awk/gsub approach for the reason recorded in #1096, and the same one src/coverage/html_file.sh already uses.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

Status
Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions