Skip to main content

Jasmine Reporter

Use the Testream Jasmine Reporter to send Jasmine 5 test results from Node.js CI/CD into Testream and Jira with CTRF output, source evidence, and CI run metadata.

Looking for the higher-level product fit first? Read the website page for CI/CD test results in Jira.

For CI context and pull-request comparison setup, see CI context and pull-request comparisons.

Installation

npm install --save-dev @testream/jasmine-reporter

Basic Configuration

Register the reporter from a Jasmine helper loaded by your configuration, such as helpers/testream-reporter.js:

helpers/testream-reporter.js
const TestreamJasmineReporter = require("@testream/jasmine-reporter");

jasmine.getEnv().addReporter(
new TestreamJasmineReporter({
apiKey: process.env.TESTREAM_API_KEY,
uploadEnabled: process.env.TESTREAM_UPLOAD_ENABLED === "true",
failOnUploadError:
process.env.TESTREAM_FAIL_ON_UPLOAD_ERROR === "true",
testEnvironment: process.env.TESTREAM_TEST_ENVIRONMENT || "ci",
appName: process.env.TESTREAM_APP_NAME || "my-app",
appVersion: process.env.TESTREAM_APP_VERSION || "1.0.0",
testType: process.env.TESTREAM_TEST_TYPE || "unit",
}),
);

Run Jasmine normally:

npx jasmine

The reporter writes ctrf/ctrf-report.json by default. It uploads the report when upload is enabled and an API key is available.

Local Report Without Upload

Generate a local CTRF report without making a network request:

new TestreamJasmineReporter({
uploadEnabled: false,
outputDir: "artifacts",
outputFile: "jasmine-results.json",
});

The reporter normalizes the report tool to jasmine and adds generatedBy: "@testream/jasmine-reporter".

Configuration Options

OptionTypeDefaultDescription
apiKeystringemptyTestream API key. Upload is skipped when no key is available.
uploadEnabledboolean | stringtrueEnable or disable automatic upload.
failOnUploadErrorboolean | stringfalseFail the Jasmine run when upload fails.
outputDirstringctrfDirectory for the CTRF report.
outputFilestringctrf-report.jsonReport filename. A .json suffix is added when omitted.
sourceRootstringprocess.cwd()Root used for source evidence discovery.
discoverFilesbooleantrueDiscover source files when Jasmine does not provide file locations.
sourceFilesstring[]Jasmine-loaded filesRestrict discovery to files relative to sourceRoot or to absolute paths. Useful for ESM or programmatic setups.
maxChars, maxLinesnumbershared defaultsBound the source evidence stored in each test result.
branchstringauto from CIOverride the Git branch name.
commitShastringauto from CIOverride the Git commit SHA.
repositoryUrlstringauto from CIOverride the repository URL.
buildName, buildNumber, buildUrlstringoptional/CIAdd build metadata or override detected CI values.
testEnvironmentstringoptionalEnvironment such as ci, staging, or local.
appName, appVersion, testTypestringoptionalApplication and test metadata.

When branch, commit, repository, build, or merge-base values are not supplied, Testream resolves supported CI context during upload. See the CI context guide for checkout requirements and supported providers.

Source Evidence

Testream adds source evidence to Jasmine results by matching test names to JavaScript or TypeScript files and recording the matched file path, line, and bounded snippet. For ESM or programmatic runners, set sourceFiles and sourceRoot as needed; set discoverFiles: false to disable scanning.

Upload Failures and Test Exit Status

Uploads are best-effort by default. Set failOnUploadError: true when a failed upload must fail the Jasmine process:

new TestreamJasmineReporter({
apiKey: process.env.TESTREAM_API_KEY,
failOnUploadError: true,
});

Jasmine test failures remain the test command's exit signal. The upload-failure option adds upload status to that signal; it does not replace Jasmine's test result handling.

Artifacts

Jasmine's standard reporter lifecycle does not provide framework-owned screenshots or videos. This package reports tests, source evidence, and CTRF metadata; artifact capture requires a separate CI or test integration.

GitHub Actions Example

.github/workflows/jasmine-tests.yml
name: Jasmine Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: actions/setup-node@v4
with:
node-version: 24

- run: npm ci

- name: Run Jasmine tests
env:
TESTREAM_API_KEY: ${{ secrets.TESTREAM_API_KEY }}
TESTREAM_UPLOAD_ENABLED: "true"
TESTREAM_FAIL_ON_UPLOAD_ERROR: "true"
TESTREAM_BUILD_NAME: ${{ github.workflow }}
TESTREAM_TEST_ENVIRONMENT: ci
TESTREAM_APP_NAME: ${{ github.event.repository.name }}
TESTREAM_APP_VERSION: ${{ github.sha }}
TESTREAM_TEST_TYPE: unit
run: npm test

NPM Package

What's Next?