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/repeats.md.
close
  • English
  • repeats

    • Type: number
    • Default: 0
    • CLI: --repeats <times>

    Number of additional runs for each individual test, useful for detecting flaky failures. With repeats: 2, each passing test runs three times. Repetition applies to individual tests, not whole files or suites: sequential tests A and B run in the order A, A, A, B, B, B.

    Each attempt runs beforeEach / afterEach and test-scoped fixture setup and cleanup. Test modules and beforeAll / afterAll are not re-executed for each repeat.

    npx rstest run --repeats 2
    rstest.config.ts
    import { defineConfig } from '@rstest/core';
    
    export default defineConfig({
      repeats: 2,
    });

    The priority from highest to lowest is: a test's TestOptions.repeats > its nearest describe default > the run({ repeats }) option or CLI --repeats flag > the configuration value > the default 0.

    Set { repeats: 0 } on a test or suite to disable inherited repetition.

    Each repeat has an independent retry budget. If a repeat still fails after its retries, the test fails and its remaining repeats stop. Without retries, the first failure stops that test's remaining repeats.