Share a Jest or Vitest HTML report
The default JS test report is a terminal scrollback, which is fine until someone who wasn't watching the terminal needs to see it. Then comes the HTML reporter, then the artifact upload, then the zip, then — reliably — a screenshot of the failure pasted into Slack.
The report is fine. It has no address.
One curl
npx jest --reporters=default --reporters=jest-html-reporter || true
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html test-report.html \
--arg title "Unit tests — $(git rev-parse --short HEAD)" \
'{title: $title, html: $html}')"
jest-html-reporter writes one self-contained file, which is the shape
that publishes in a single call. Use a scoped token
(reports:write) from CI secrets, and PATCH a saved report id rather
than POSTing — that keeps one URL with a revision per run instead of a
new orphan link every build.
Vitest's HTML reporter has a directory
vitest --reporter=html writes html/index.html plus the result data
beside it, and the page fetches that data at view time. Publish the
index as the body and upload the siblings as assets:
for f in html/assets/* html/*.json; do
curl -fsS -X POST \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID/assets" \
-H "Authorization: Bearer $COMMA_API_TOKEN" -F "file=@$f"
done
Relative references are rewritten to the uploaded assets, so the page finds its data. This is the same pattern that Allure and Gatling need, and it's worth knowing once.