Share a Mochawesome report
Mochawesome solves the ugly part of Mocha output and stops there. You get a
clean HTML report with pass/fail counts, expandable suites and captured
errors — written to mochawesome-report/ on a CI worker, retained for seven
days, and opened by approximately nobody, because opening it means finding
the run, downloading the artifact, unzipping it and double-clicking a file.
So the team reads the red text in the log instead, which is the one place the report was supposed to replace.
Publish it
npx mocha --reporter mochawesome
npx marge mochawesome-report/mochawesome.json --inline -o report
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 report/mochawesome.html \
--arg title "API suite — $(date +%F)" \
'{title: $title, html: $html}')"
--inline folds the CSS and JavaScript into the HTML, so the whole report is
one file and the publish step is one command. Without it, drop the report
folder in instead — the entry HTML plus its assets/ directory upload
together and relative references are rewritten.
Run the publish step with if: always() (or your CI's equivalent), because
the run you most need to share is the one that failed.
What the URL changes
- Failures get a conversation. Highlight the assertion, pin "known race, ticket QA-88, fix in flight". See commenting on HTML.
- Flakes get a history. One report id per suite, one revision per run — the pattern becomes visible instead of anecdotal.
- Non-engineers can look. A product manager checking whether the release suite is green opens a link, not a CI console.
Limits
- HTML body: 5 MB — inlined reports for very large suites can exceed it;
publish per suite, or drop
--inlineand upload the folder. - Scripts run, sandboxed:
allow-scripts, noallow-same-origin. - 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.