For AI agents: the complete documentation index is available at https://rstest.rs/llms.txt, the full documentation bundle is available at https://rstest.rs/llms-full.txt, and this page is available as Markdown at https://rstest.rs/config/test/reporters.md.
close
  • English
  • reporters

    • Type:
    type ReporterConfig =
      | BuiltInReporterNames
      | (string & {})
      | [name: string, options: Record<string, unknown>]
      | Reporter;
    type Reporters = ReporterConfig | ReporterConfig[];
    process.env.GITHUB_ACTIONS === 'true'
      ? ['default', 'github-actions']
      : ['default'];
    • CLI: --reporters=<name> --reporters=<name1> (--reporter is also accepted as an alias)

    Configure which reporters to use for test result output.

    Built-in reporter names include default, dot, verbose, md, github-actions, junit, json, and blob.

    AI agent environments

    If you haven't explicitly configured any reporters (no reporters in config and no --reporters flags), Rstest defaults to ['md'] and outputs AI agent-friendly markdown to stdout.

    Usage

    Basic example

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

    CLI
    rstest.config.ts
    npx rstest --reporters=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 use a custom reporter module by passing its module specifier, or a tuple with options. The module must default export a reporter class. Rstest constructs it with the options (an empty object for the string form) and a context containing rootPath and the resolved config. The module can be JavaScript or TypeScript; .ts and .mts modules load directly on Node runtimes with type stripping enabled (Node 22.18+ or 24):

    rstest.config.ts
    import { defineConfig } from '@rstest/core';
    
    export default defineConfig({
      reporters: './custom-reporter.js',
    });
    
    // To pass options:
    export const configWithOptions = defineConfig({
      reporters: [['./custom-reporter.js', { outputPath: './report.json' }]],
    });

    You can also pass an already constructed object that implements the Reporter interface. Reporter classes cannot be passed directly.