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 quarantineGotchas
- 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
How to Automatically Retry Flaky Tests with GitHub ActionsRe-run only the failed tests in a Jest suite on GitHub Actions with jest.retryTimes or jest --onlyFailures, s…
How to Publish Test Results as a Check with GitHub ActionsTurn a JUnit XML test report into a GitHub Actions check run with dorny/test-reporter, so failures appear inl…