Share a Jasmine test report

Jasmine has been around long enough that most suites running it are the ones nobody wants to touch — which is exactly when a readable run matters, because the person deciding whether a change is safe is rarely the person who can run the suite.

The console reporter cannot help with that. jasmine-reporters can.

Write JUnit XML

npm i -D jasmine-reporters
// spec/helpers/reporter.js
const reporters = require("jasmine-reporters");

jasmine.getEnv().addReporter(
  new reporters.JUnitXmlReporter({
    savePath: "reports",
    consolidateAll: true,
  }),
);

consolidateAll: true gives you one file instead of one per spec file, which is what you want if the next step is a single page.

Convert and publish

npx jasmine || true
npx junit-viewer --results=reports/junitresults.xml --save=jasmine.html

Then drag jasmine.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 jasmine.html \
        --arg title "Jasmine — $GITHUB_REF_NAME" '{title: $title, html: $html}')"

One id per suite. Every run becomes a revision of the same URL.

The browser runner

If you run specs in a real browser with the Jasmine HTML reporter, the page that renders the results is already HTML — screenshot-free publishing is a matter of saving it rather than converting anything. The same applies to a Karma report, which wraps the same idea in a runner.

Why publish it

  • Anchored threads on the spec in question, so "this one has been failing since the Node bump" is recorded where somebody will find it. See commenting on HTML.
  • Revisions across runs, which is the only honest way to argue about flakes.
  • 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