Share a Minitest report

Rails ships Minitest, which means a very large number of Ruby suites produce exactly one artifact: a line of dots and, if you are lucky, a backtrace. Fine for the person who typed rails test. Useless for everyone else.

The minitest-reporters gem has written HTML this whole time.

Register the HTML reporter

# Gemfile
gem "minitest-reporters", group: :test
# test/test_helper.rb
require "minitest/reporters"

Minitest::Reporters.use! [
  Minitest::Reporters::ProgressReporter.new,
  Minitest::Reporters::HtmlReporter.new(reports_dir: "test/reports"),
]

Keep the progress reporter for the terminal; the HTML reporter is for everyone who isn't at that terminal.

bin/rails test || true
# → test/reports/index.html

Publish it

Drag test/reports/index.html into the app, or from CI:

curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
  -H "Authorization: Bearer $COMMA_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d "$(jq -n --rawfile html test/reports/index.html \
        --arg title "Minitest — $GITHUB_REF_NAME" '{title: $title, html: $html}')"

One id per suite, PATCHed every run, if: always() so failures publish.

Or JUnit, if something downstream wants XML

Minitest::Reporters.use! Minitest::Reporters::JUnitReporter.new

Then convert with junit2html if you still want the page. Same destination, one more hop — worth it only when another tool in the pipeline already consumes the XML.

What the link adds

  • Anchored threads on a specific failure, so "this is the fixture, not the code" is recorded next to the test. See commenting on HTML.
  • Revisions per run, which turns flake arguments into a diff.
  • Access per report — private, team, domain-gated, or named reviewers. See the sharing model.

Limits

  • Entry HTML: 5 MB. Assets: 25 MB per file, 250 MB and 500 files total.
  • 60 requests/minute per token.

Try it

Comma is free — unlimited reports, unlimited commenters, unlimited revision history.

Publish a test report →

Related