Share a Stryker mutation report
Stryker's HTML report is the best-designed artifact in JavaScript testing:
a file tree, a mutation score per directory, and source with every killed and
surviving mutant marked inline. It is also a file at
reports/mutation/mutation.html on a CI runner, and its usual fate is a
number in a Slack message.
"Mutation score 61%." Nobody has ever fixed a test from that sentence.
Publish the file
npx stryker run
Drag reports/mutation/mutation.html into
the app, or from CI:
npx stryker run || true
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 reports/mutation/mutation.html \
--arg title "Mutation — $GITHUB_SHA" '{title: $title, html: $html}')"
Stryker exits non-zero below thresholds.break, so either tolerate the exit
code on the run step or publish with if: always().
The report is self-contained — no assets folder to carry — so this is one of the easier artifacts to wire up.