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/max-concurrency.md.
close
  • English
  • maxConcurrency

    • Type: number
    • Default: 5
    • CLI: --maxConcurrency=10

    Limit the number of test cases running at the same time within a test file when using test.concurrent or describe.concurrent. Cases above the limit wait until a slot is released.

    With sequence.hooks: 'parallel', this value also limits concurrent lifecycle hooks and returned cleanup functions within a file. Hooks use a separate limit from concurrent test cases.

    Increasing this value does not make ordinary test() cases concurrent. Mark the tests or their suite as concurrent to opt in.

    SettingControlsDoes not control
    pool.maxWorkersWorkers running Node.js test files in parallelConcurrent cases within a file
    maxConcurrencyConcurrent cases within each test fileHow many files run in parallel
    isolateWhether files share module state and their test environmentHow many tests run at once

    For example, pool.maxWorkers: 1 runs Node.js test files one at a time, but each file can still run multiple test.concurrent cases. Set maxConcurrency: 1 as well if those cases must also run one at a time.

    CLI
    rstest.config.ts
    npx rstest --maxConcurrency=10