Skip to content

ccjs run rerun

Detect and manage flaky tests by running them multiple times.

Usage

bash
ccjs run rerun [options]

How It Works

The rerun command executes your test suite multiple times to identify tests that pass inconsistently. This is essential for maintaining test reliability in CI pipelines.

Flags

FlagShortDescription
--min-success <n>Minimum successful runs required (default: 2)
--max-reruns <n>Maximum number of attempts (default: 4)
--config <path>-cSpecify a custom config file

Configuration

Configure rerun behavior in codecept.conf.ts:

typescript
rerun: {
  minSuccess: 3,   // require 3 successful runs
  maxReruns: 5,    // try up to 5 times
},

Common Strategies

Use CaseConfigurationWhen to Use
Find flaky testsminSuccess: 1, maxReruns: 5Initial discovery
Confirm stabilityminSuccess: 3, maxReruns: 5Before merging PRs
Full stability auditminSuccess: 10, maxReruns: 10Before releases

Examples

bash
# Run with default settings
ccjs run rerun

# Custom thresholds
ccjs run rerun --min-success 3 --max-reruns 5

TIP

The min-success and max-reruns values can also be configured directly in codecept.conf.ts under the rerun key, which takes precedence over CLI defaults.

Released under the MIT License. Built with ❤️ on top of CodeceptJS.