Share a Vitest HTML report
Vitest's HTML reporter is a genuinely nice artifact — the failure tree, the
diff for the assertion that blew up, the module graph — and it has an unusual
property: you cannot open it by double-clicking it. The page loads its
results as a JSON module, and file:// origins block module fetches, so the
official instructions are to spin up vite preview first.
Which means the report exists in exactly one place: on the machine that ran the tests. Everything downstream is a terminal screenshot.
Publish the folder
npm i -D @vitest/ui
npx vitest run --reporter=html # → html/
Drag html/ (or a zip of it) into the app:
index.htmlbecomes the report body.- The results JSON, the bundle and the assets upload alongside it, and their
relative references are rewritten to the uploaded copies — which is exactly
the step
file://cannot do. - Scripts run inside a sandboxed iframe (
allow-scripts, noallow-same-origin), so the filters and detail panes work.
One URL. No preview server, no "run this command first" in the message you send a teammate.
From CI
npx vitest run --reporter=html
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 html/index.html \
--arg title "Unit tests — $GITHUB_SHA" '{title: $title, html: $html}')"
Run the step with if: always() (GitHub Actions), when: always (GitLab,
CircleCI) or post { always { … } } (Jenkins). A green run's report is nice
to have; a red run's report is the entire point.
PATCHing one report id keeps a single URL per suite and appends a revision per run — so "was this failing yesterday?" is a diff, not an archaeology expedition through expired artifacts.
What review adds
The value of a shared test report is not the pass count, it is the record of what the team decided about a failure:
- Anchored threads on the failing test — see commenting on HTML.
- Revisions, so a flake's history is visible rather than remembered.
- 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. A huge suite's results JSON is the file to watch; shard the suite if it gets close.
- 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.