close

reporters

  • Type:
type Reporter = ReporterName | [ReporterName, ReporterOptions];
type Reporters = Reporter | Reporter[];
  • Default:
process.env.GITHUB_ACTIONS === 'true'
  ? ['default', 'github-actions']
  : ['default'];
  • CLI: --reporter=<name> --reporter=<name1>

Configure which reporters to use for test result output.

Usage

Basic example

You can specify reporters in the rstest.config.ts file or via the CLI.

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

Multiple reporters

You can use multiple reporters to output test results in different formats simultaneously. This is useful when you want both console output and a file report for CI/CD pipelines.

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

export default defineConfig({
  reporters: ['default', 'junit'],
});

Configuring reporters with options

Many reporters support configuration options. Pass them as a tuple [reporterName, options]:

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

export default defineConfig({
  reporters: [
    ['default', { verbose: true }],
    ['github-actions', { verbose: true }],
    ['junit', { outputPath: './test-results.xml' }],
  ],
});

Using custom reporters

You can create and use custom reporters by providing a reporter class or object that implements the reporter interface:

rstest.config.ts
import { defineConfig } from '@rstest/core';
import { CustomReporter } from './custom-reporter';

export default defineConfig({
  reporters: [CustomReporter],
});