close

Reporters

Reporters in Rstest control how test results are displayed and processed.

You can use built-in reporters to get different output formats or create custom reporters to integrate with your workflow.

Using reporters

You can configure reporters through:

  1. CLI: --reporter=<name> (can be used multiple times)
  2. Config file: Add reporters to your rstest.config.ts
import { defineConfig } from '@rstest/core';
import { customReporter } from './path/to/custom-reporter';

export default defineConfig({
  reporters: [
    'default', // Simple string reporter
    ['junit', { outputPath: './test-results.xml' }], // Reporter with options
    customReporter, // Custom reporter instance
  ],
});

More configuration options can be found in the Reporters Configuration documentation.

Reporter options for built-in reporters are defined in the TypeScript types: packages/core/src/types/reporter.ts

Built-in reporters

Rstest provides several built-in reporters:

ReporterPurposeUse case
defaultConsole output with colorsLocal development
dotCompact per-test markersFast local feedback
verboseDetailed test case outputDebugging test failures
github-actionsCI error annotationsGitHub Actions workflows
junitJUnit XML formatCI/CD integration
jsonStructured JSON reportCI tooling and scripting
mdMarkdown agent reportAgent / LLM integrations
blobSerialized JSON outputMerging sharded reports

Default reporter

The default reporter displays test run status, results, and summary information in your terminal with colored output.

Output example:

 test/index.test.ts (2)

 Test Files 1 passed
      Tests 2 passed
   Duration 112ms (build 19ms, tests 93ms)

Configuration options:

  • summary: Whether to display summary information (default: true)
  • logger: Custom logger function for output (default: process.stdout/process.stderr)

Progress reporting

The default reporter provides progress feedback during test execution, adapting to your environment.

TTY environments (interactive terminal)

In interactive terminals, the default reporter displays real-time test progress at the bottom of the terminal. This includes currently running test files and individual test cases that have been running for more than 2 seconds.

 RUNS  src/database.test.ts
   > should handle concurrent writes 5s

 Test Files 12 passed | 1 running
      Tests 45 passed
   Duration 30s

This live status updates every second and is automatically cleared when tests complete.

Non-TTY environments (CI, piped output, AI agents)

In non-TTY environments, the default reporter automatically logs a progress summary when there is no console output for 30 seconds. This prevents CI "no output" timeouts (e.g., GitHub Actions kills processes after 10 minutes of silence) and provides visibility into test execution without cluttering actively-producing output.

[PROGRESS] test files: 20 done, 4 running | tests: 380 passed, 3 failed | 2m 30s
            Running: src/heavy.test.ts > database > concurrent writes 45s
            Running: src/other.test.ts

When a test case runs longer than 10 seconds, its name and elapsed time are shown. This helps identify stuck or slow tests. Progress reporting stops after 20 reports (~10 minutes of idle time) to avoid blocking CI timeout mechanisms when tests are truly stuck.

Verbose reporter

The verbose reporter extends the default reporter and outputs detailed information for all test cases, including successful ones. Features like progress reporting are also available. Use this when you need complete visibility into test execution.

CLI
rstest.config.ts
npx rstest --reporter=verbose

Output example:

 test/index.test.ts (2) 2ms
 Index > should add two numbers correctly (1ms)
 Index > should test source code correctly (1ms)

 Test Files 1 passed
      Tests 2 passed
   Duration 112ms (build 19ms, tests 93ms)

Dot reporter

The dot reporter emits a compact marker stream with one character per test case:

  • · for passed tests
  • x for failed tests
  • - for skipped tests
  • * for todo tests
CLI
rstest.config.ts
npx rstest --reporter=dot

It still prints the regular failing-test summary and duration footer after the marker line.

GitHub Actions reporter

Outputs error messages using GitHub Actions workflow commands when tests fail, enabling rich error annotations in your CI.

Auto-enablement: Automatically enabled in GitHub Actions environments.

CLI
rstest.config.ts
npx rstest --reporter=github-actions

When tests fail, the GitHub Actions reporter outputs information in a format similar to:

::error file=src/index.ts,line=4,col=17,title=test/index.test.ts > should add two numbers correctly::expected 2 to be 4

These outputs are parsed by GitHub Actions and generate comments at the corresponding locations.

rstest-github-actions-example

Auto-enablement

When no reporter is manually set, Rstest automatically enables this reporter when it detects a GitHub Actions environment (process.env.GITHUB_ACTIONS is 'true').

Manual enablement

You can also manually enable this reporter:

CLI
rstest.config.ts
npx rstest --reporter=github-actions

JUnit reporter

Generates test reports in JUnit XML format, perfect for CI/CD integration and test result aggregation.

CLI
rstest.config.ts
npx rstest --reporter=junit

Configuration options:

  • outputPath: Output file path (defaults to console output)

The JUnit reporter generates XML format as follows:

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="rstest tests" tests="3" failures="1" errors="1" skipped="1" time="0.3" timestamp="2024-01-01T00:00:00.000Z">
  <testsuite name="test1.test.ts" tests="3" failures="1" errors="1" skipped="1" time="0.3" timestamp="2024-01-01T00:00:00.000Z">
    <testcase name="should pass" classname="test1.test.ts" time="0.1">
    </testcase>
    <testcase name="should fail" classname="test1.test.ts" time="0.2">
      <failure message="Test failed" type="AssertionError">expected 'hi' to be 'hii' // Object.is equality - Expected + Received - hii + hi at test1.test.ts:10:21</failure>
    </testcase>
    <testcase name="should skip" classname="test1.test.ts" time="0.0">
      <skipped/>
    </testcase>
  </testsuite>
</testsuites>

The JUnit reporter maps test case execution status to JUnit test status:

  • pass: Test passed
  • fail: Test failed, generates <failure> tag
  • skip: Test skipped, generates <skipped> tag
  • todo: Test todo, generates <skipped> tag

JSON reporter

Generates a stable JSON document for CI tooling, custom dashboards, or post-processing scripts.

CLI
rstest.config.ts
npx rstest --reporter=json

Configuration options:

  • outputPath: Output file path (defaults to stdout)

Output shape:

  • status: Overall run status (pass or fail)
  • summary: Counts for files and tests
  • durationMs: Total, build, and test durations in milliseconds
  • snapshot: Snapshot summary from the run
  • files: Test-file level results with nested test cases
  • tests: Flattened test-case results, each with fullName
  • consoleLogs: Captured user console output when available
  • unhandledErrors: Top-level unhandled errors when present

The JSON reporter writes relative testPath values so the output remains stable across different machines and CI workspaces.

Markdown reporter

The markdown reporter outputs a single markdown document to stdout, designed for agent / LLM consumption.

In agent environments, Rstest defaults to md only when you didn't explicitly configure reporters.

The default preset is normal, which is tuned for agent workflows:

  • Each failure includes a repro command (file+name) so an agent can rerun a single failing case.
  • Stack output defaults to top (a stable anchor frame) instead of full stack frames.
  • Console output is enabled by default, but limited to keep the report size under control.
  • When the number of failures exceeds failures.max, the reporter prints a full failure list with minimal fields (repro / type / message / expected / actual), and only expands full details for the first failures.max failures.

The available presets mainly differ in how much detail they keep in failure sections:

PresetBest forFailure detailsConsole logsCode frames
normalDefault agent workflowsstack: 'top', failures.max: 50Enabled, capped at 10 logs per test path and 500 chars per entryEnabled, 2 lines above and below
compactCI logs, repeated agent loops, token-sensitive runsstack: 'top', failures.max: 20DisabledDisabled
fullDeep debugging when you want maximum context in one reportstack: 'full', failures.max: 200Enabled, capped at 200 logs per test path and 5000 chars per entryEnabled, 3 lines above and below

All presets still keep the same markdown structure. The main difference is how much failure context is expanded by default.

CLI
rstest.config.ts
npx rstest --reporter=md

The default output always starts with a report title, then shows a summary section, test lists when needed, and a failures section.

When all tests pass, an excerpt looks like this:

## Summary

```json
{
  "status": "pass",
  "counts": {
    "testFiles": 2,
    "failedFiles": 0,
    "tests": 14,
    "failedTests": 0,
    "passedTests": 13,
    "skippedTests": 1,
    "todoTests": 0
  }
}
```

## Failures

No test failures reported.

Note: all tests passed. Lists omitted for brevity.

When there are failures, an excerpt looks like this:

## Summary

```json
{
  "status": "fail",
  "counts": {
    "testFiles": 1,
    "failedFiles": 1,
    "tests": 1,
    "failedTests": 1,
    "passedTests": 0,
    "skippedTests": 0,
    "todoTests": 0
  }
}
```

## Failures

### [F01] fixtures/agent-md/index.test.ts :: agent-md > fails with diff

details:

```json
{
  "testPath": "fixtures/agent-md/index.test.ts",
  "fullName": "agent-md > fails with diff",
  "status": "fail"
}
```

diff:

```diff
- Expected
+ Received

- 3
+ 2
```

If you want a smaller payload for CI logs or multi-step agent loops, switch to the compact preset and lower the failure cap:

rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  reporters: [
    [
      'md',
      {
        preset: 'compact',
        failures: { max: 20 },
        reproduction: 'file+name',
      },
    ],
  ],
});

Blob reporter

The blob reporter serializes test results into JSON files for later merging. This is designed for use with test sharding in CI environments, where tests are split across multiple machines and results need to be combined afterward.

CLI
rstest.config.ts
npx rstest run --shard 1/3 --reporter=blob

Configuration options:

  • outputDir: Directory to store blob report files (default: .rstest-reports)
rstest.config.ts
import { defineConfig } from '@rstest/core';

export default defineConfig({
  reporters: [['blob', { outputDir: './custom-blob-output' }]],
});

Blob files are saved to .rstest-reports/ by default. After all shards complete, use rstest merge-reports to combine them into a unified report.

See the shard configuration for a complete CI workflow example.

Custom reporters

For advanced integration needs, you can create custom reporters by implementing the Reporter interface.

More details can be found in the Reporter API reference.