Skip to main content

Vitest Reporter

Use the Testream Vitest Reporter to send Vitest test results from CI/CD into Testream and Jira with run metadata and CI-friendly uploads.

Looking for the broader use case? Read the website page for Vitest Jira integration.

If you are deciding between Vitest-specific setup and the broader upload path, compare this guide with 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/vitest-reporter

Basic Configuration

Add the reporter to your vitest.config.ts:

vitest.config.ts
import { defineConfig } from "vitest/config";

export default defineConfig({
test: {
reporters: [
"default",
[
"@testream/vitest-reporter",
{
apiKey: process.env.TESTREAM_API_KEY,
uploadEnabled: true,
},
],
],
},
});

Configuration Options

OptionTypeDefaultDescription
apiKeystring-Required Testream API key
uploadEnabledbooleantrueEnable/disable automatic upload
failOnUploadErrorbooleanfalseFail the test run if upload fails
outputDirstringctrfCTRF output directory
outputFilestringctrf-report.jsonCTRF report filename
branchstringauto (CI)Git branch name
commitShastringauto (CI)Git commit SHA
repositoryUrlstringauto (CI)Git repository URL
buildNamestring-Build name/identifier
buildNumberstringauto (CI)Build number
buildUrlstringauto (CI)Build URL
testEnvironmentstring-Test environment (e.g., ci, staging)
appNamestring-Application name
appVersionstring-Application version
testTypestringunitTest type (e.g., unit, integration, e2e)

Full Configuration Example

vitest.config.ts
import { defineConfig } from "vitest/config";
import { loadEnv } from "vite";

export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), "");

return {
test: {
include: ["__tests__/**/*.test.ts"],
reporters: [
"default",
[
"@testream/vitest-reporter",
{
apiKey: process.env.TESTREAM_API_KEY || env.TESTREAM_API_KEY,
uploadEnabled: true,
failOnUploadError:
process.env.TESTREAM_FAIL_ON_UPLOAD_ERROR === "true",
buildName: process.env.TESTREAM_BUILD_NAME,
testEnvironment:
process.env.TESTREAM_TEST_ENVIRONMENT || "local",
appName: process.env.TESTREAM_APP_NAME || "vitest-example",
appVersion: process.env.TESTREAM_APP_VERSION || "1.0.0",
testType: process.env.TESTREAM_TEST_TYPE || "unit",
},
],
],
},
};
});

Notes

  • The reporter writes the CTRF report to ctrf/ctrf-report.json by default.
  • Git context (branch/commit/repository) is auto-detected in many CI environments if not provided.

GitHub Actions Example

.github/workflows/vitest-tests.yml
name: Vitest 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 Vitest tests
env:
TESTREAM_API_KEY: ${{ secrets.TESTREAM_API_KEY }}
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
TESTREAM_FAIL_ON_UPLOAD_ERROR: "true"
run: npm test

Sample Project

The testream/vitest-jira-reporter repository is a complete working example of a Vitest project integrated with Testream. It includes example tests, full reporter configuration, and a ready-to-use GitHub Actions workflow.

NPM Package

What's Next?