Skip to content

Bring the HTML reporter into Rubytest - #14

Merged
trans merged 2 commits into
masterfrom
feature/html-reporter
Nov 17, 2026
Merged

trans merged 2 commits into
masterfrom
feature/html-reporter

Conversation

@trans

@trans trans commented Nov 17, 2026

Copy link
Copy Markdown
Member

Adds rubytest -f html, so the HTML report no longer needs rubytest-html.

Stacked on #13: this branch includes its commit, because both add an Unreleased section to HISTORY.md. Merge #13 first; the diff here then shrinks to the second commit.

Why a rewrite

rubytest-html 0.1.0 predates the recorder: it has no record or finish, so rubytest 0.10 rejects it with "report format html does not support result reporting". It also wrote test names and messages into the page unescaped, put <li> elements outside any list, never reported skips, and signed itself "Lemon".

What it does now

  • Writes one self-contained HTML document when the run finishes: a tally, then each result under the heading of its case, nested as the suite is.
  • Escapes everything it writes.
  • Reports all five statuses, including skipped tests and cases, with the reason for a skip and the message for a pending test.
  • Shows the class, message and location of each failure, and the cleaned backtrace of each error.
  • Captures test output and shows it with the test that wrote it, so it can't land in the middle of the markup.
  • Takes an output: stream like the other bundled reporters, and follows the system's light or dark colour scheme.

Testing

  • bundle exec rake test: 6 demos, 47 steps, 138 assertions, all passing on Ruby 3.4.9 and in a ruby:2.7 container. The new section in demo/05_builtin_reporters.md checks one result element per recorded result, balanced case sections, every status, and that markup in names and output is escaped.
  • rubytest -f html on a file with a passing, failing, erroring, pending and skipped test inside and outside a case: the document's tags are balanced (checked with an HTML parser).
  • Not looked at in a browser.

🤖 Generated with Claude Code

trans and others added 2 commits November 17, 2026 13:57
Add rubytest/rake with Test::Rake::TestTask, from rubytest-rake 0.2.0.

Check the forked run's exit status, so the task fails when the run does:
rubytest-rake waited for the child and then always exited 0. Use only the
default globs that match a file, since the runner now fails a glob that
matches nothing. Let TEST replace the task's files for one invocation.
Drop the shell mode, which called an undefined method.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
rubytest-html's reporter predates the recorder and no longer loads.
Rewrite it on record and finish: one self-contained document, written when
the run finishes, with results nested under their cases. Escape names,
messages and output, report skipped tests and cases, and capture test
output so it appears with its test.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@trans
trans merged commit 8238dfd into master Nov 17, 2026
6 checks passed
@trans trans mentioned this pull request Nov 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant