Skip to content
Latchkey

How to Quarantine a Known Flaky Test with GitHub Actions

Quarantining moves a flaky test into a non-blocking job so it stops failing PRs while staying visible.

Tag the flaky test (for example with a @quarantine tag or test group), exclude it from the main run, and run the quarantined set in a separate job marked continue-on-error. The signal stays visible without blocking merges.

Steps

  • Tag the flaky test and exclude that tag from the main test command.
  • Add a second job that runs only the quarantined tag with continue-on-error: true.
  • Track quarantined tests so they get fixed, not forgotten.

Workflow

.github/workflows/ci.yml
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npx jest --testPathIgnorePatterns quarantine
  quarantine:
    runs-on: ubuntu-latest
    continue-on-error: true
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - run: npx jest quarantine

Gotchas

  • Quarantine is temporary; an ignored flaky test is a hidden gap in coverage.
  • For transient infra flakiness rather than test bugs, Latchkey managed runners auto-heal the run instead, which is a different remedy.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →