---
title: "Flaky tests: what they are, why they hurt, and how to kill them"
description: "The authoritative guide to flaky tests: named patterns, root causes, and fixes, framework by framework. Written by the engineers behind Mergify Test Engine."
url: https://mergify.com/learn/flaky-tests
---

# Flaky tests.  
Named, fixed, quarantined.

Flaky tests are not random noise. They follow patterns, and the patterns are specific to each test framework. Once you name the pattern, you can kill it. This guide covers every major framework, with the fixes we have seen work across thousands of CI pipelines.

By [Julien Danjou](https://mergify.com/about), Co-founder & CEO of MergifyUpdated May 19, 2026

[Try Mergify Test Engine](https://dashboard.mergify.com/)[See the product](https://mergify.com/product/test-engine)

## Pick your framework

Every framework has its own flakiness patterns. Start with yours.

[

Jest

Fake timers, snapshot drift, and the async traps behind flaky Jest suites.

Read the guide →](https://mergify.com/learn/flaky-tests/jest)[

pytest

Fixture teardown races, xdist ordering, and Hypothesis seed non-determinism.

Read the guide →](https://mergify.com/learn/flaky-tests/pytest)[

Cypress

cy.wait() races, network stubbing, and retry-ability gotchas.

Read the guide →](https://mergify.com/learn/flaky-tests/cypress)[

Playwright

Auto-waiting versus explicit waits, trace-level debugging, and retry config.

Read the guide →](https://mergify.com/learn/flaky-tests/playwright)[

Vitest

Thread vs fork pool, mock hoisting, and shared-state snapshot flakiness.

Read the guide →](https://mergify.com/learn/flaky-tests/vitest)[

RSpec

Order-dependent specs, database\_cleaner strategies, and rspec-retry pitfalls.

Read the guide →](https://mergify.com/learn/flaky-tests/rspec)[

Minitest

Parallelization races, fixture loading, and test isolation in Rails suites.

Read the guide →](https://mergify.com/learn/flaky-tests/minitest)[

Go

t.Parallel() races, goroutine leaks, and nondeterministic map iteration.

Read the guide →](https://mergify.com/learn/flaky-tests/go)[

Rust

Test-thread races, async runtime drift, and cargo test parallelism.

Read the guide →](https://mergify.com/learn/flaky-tests/rust)[

JUnit

Method ordering, Surefire forking, and shared static state in Spring tests.

Read the guide →](https://mergify.com/learn/flaky-tests/junit)[

TestNG

Dependency groups, parallel methods, and retry analyzers done wrong.

Read the guide →](https://mergify.com/learn/flaky-tests/testng)[

PHPUnit

Test isolation, database transactions, and dataProvider non-determinism.

Read the guide →](https://mergify.com/learn/flaky-tests/phpunit)[

Pest

Higher-order tests, parallel execution, and the Laravel testing stack.

Read the guide →](https://mergify.com/learn/flaky-tests/pest)[

NUnit

ParallelizableAttribute, TestContext races, and fixture reuse pitfalls.

Read the guide →](https://mergify.com/learn/flaky-tests/nunit)[

MSTest

Assembly initialization, DeploymentItem races, and parallel test settings.

Read the guide →](https://mergify.com/learn/flaky-tests/mstest)

## Kill flaky tests across every framework in your stack.

Mergify merges more than half a million pull requests a month without breaking main.

[Get started](https://dashboard.mergify.com/)[Read the docs](https://docs.mergify.com/test-engine/)
