---
title: Test States
description: Quarantine a test so its failures stop blocking your CI, or skip it so it does not run at all.
---

A test state changes how your CI treats a test, on every branch, pipeline and
job or only on the ones you name. A **quarantined** test still runs, but its
failures no longer fail your CI. A **skipped** test does not run at all.

## Choosing a state

Quarantine a flaky or broken test while you fix it. [Test Engine](/test-engine)
keeps collecting its runs, so its health stays visible and the quarantine can
end on its own once the test recovers.

Skip a test that must not run, such as one that hangs or wipes a shared
resource. A skipped test reports no failures, so nobody sees if it breaks.
Mergify never removes a skip on its own.

## Setting a state

A test holds at most one state on a given run: to skip a quarantined test,
remove its quarantine first, or narrow where the quarantine applies.

### From the Mergify dashboard

On the [Detection page](https://dashboard.mergify.com/test-engine/detection),
click a test, then **Override**: choose **Quarantined** or **Skipped**, where it
applies, and why. To act on several tests at once, select them in the list:
**Quarantine** quarantines or skips them, and **Unquarantine** and **Unskip**
remove their states. See
[quarantine on Detection](/test-engine/detection#quarantine-on-detection) for
the cleanups it suggests.

### From the Mergify CLI

The [Mergify CLI](/cli/tests) manages quarantines from a script or an AI coding
agent:

```bash
# Quarantine a test.
mergify tests quarantines add -r owner/repo \
  --reason "flaky under load, fix in progress" \
  "tests/auth/test_login.py::test_login_timeout"

# Remove it from quarantine.
mergify tests quarantines remove -r owner/repo \
  "tests/auth/test_login.py::test_login_timeout"

# List everything currently quarantined.
mergify tests quarantines list -r owner/repo
```

A test quarantined on several branches, pipelines or jobs holds one quarantine
for each, so `remove` and `get` refuse its name: pass the quarantine ID that
`add` and `list` print.

### From the API

The [test states API](/api/test-insights) manages both states.

## How a state applies in your CI

A quarantine applies with every
[test framework integration](/test-engine/test-frameworks), a JUnit report
uploaded after the run included.

A skip needs the Mergify plugin for pytest, RSpec, Vitest, Playwright, Jest,
Mocha or Minitest, which keeps the test from running and reports it skipped,
with the reason `Skipped by Mergify` where the framework shows one. A test in a
JUnit report uploaded after the run is not skipped: it ran, and its failures
count. Neither state reaches a Jest or Playwright project not wrapped with
`withMergify`, or a Playwright test that does not import `test` from
`@mergifyio/playwright`.

## When Mergify quarantines a test itself

> **Figure:** A test is active or quarantined. You move it either way by hand; the teal arrows are Mergify moving it on its own, once you turn those options on.
>
> State diagram of a test's two states. Active: its failures count in your CI outcome. Quarantined: it still runs, and its failures are ignored. You move a test from one state to the other by hand, either way, from the dashboard, the CLI or the API. With auto-quarantine on, Mergify quarantines a flaky test once enough evidence backs the verdict, and a broken one too when Also Quarantine Broken Tests is on. With unquarantine_when_healthy on, Mergify makes a quarantined test active again once it is healthy again on the default branch.

Mergify can also quarantine a test on its own, from the health status
[Detection](/test-engine/detection) assigns it. This is auto-quarantine, which
you turn on per repository from the
[Configuration page](/test-engine/configuration#auto-quarantine). By default it
quarantines flaky tests only; turn on **Also Quarantine Broken Tests** to
quarantine broken tests too.

It waits until enough evidence backs the verdict, the same evidence it needs to
[rerun a test](/test-engine/detection#rerunning-unhealthy-tests). Until then,
you can quarantine it yourself.

## Leaving quarantine automatically

With `unquarantine_when_healthy` turned on, Mergify removes a test from
quarantine once it is healthy again on every tracked branch, meaning Detection
no longer finds it flaky or broken. A test you fixed counts toward your CI
again without you going back to the dashboard.

The option is off by default. You can set it on a quarantine you create
yourself, from the dashboard or the API. For the tests Mergify quarantines for
you, turn on **Unquarantine Recovered Tests Automatically** on the
[Configuration page](/test-engine/configuration#auto-quarantine). Turning it on
does not change quarantines that already exist.

> **Figure:** Mergify quarantines a flaky test once enough evidence backs the verdict, which can be well after it turns flaky. With Unquarantine Recovered Tests Automatically turned on, Mergify ends the quarantine once the test is healthy again.
>
> Timeline of one test on the default branch, with auto-quarantine and Unquarantine Recovered Tests Automatically both turned on. The test is healthy, then turns flaky. It stays flaky for a while before Mergify quarantines it, once there is enough evidence behind the verdict. It stays quarantined while it is flaky. Once it is healthy again, Mergify removes it from quarantine.

## Fixing a quarantined test with AI

A quarantined test still needs a fix. Click it on the
[Detection](/test-engine/detection) page: each of its quarantines has a **Fix
with AI** button, which turns what Mergify knows about the test into
instructions for an AI coding agent.

**Copy Instructions** copies them to paste into any agent. The other entries
open Claude Desktop, Claude Code on the web, Claude Code in your terminal, or
Cursor, with the instructions as the prompt.

The instructions ask the agent to reproduce the failure and fix its root cause,
in the test or in the code under test, rather than delete or skip the test.
Claude and Cursor cap a prompt's length, so
only **Copy Instructions** always carries them in full.

## Staying notified

Every change of state, yours or Mergify's, is an event on the dashboard, and
[Test Engine notifications](/integrations/slack#test-engine-notifications) can
post them to a Slack channel.
