Hunt Down Weak Tests
dart_mutant applies small, targeted mutations to your Dart code and runs
dart test against each one. Mutations that survive reveal tests that
don't actually verify behaviour. AST-based, parallel, written in Rust.
# Navigate to your Dart project
$ cd your_dart_project
# Run mutation testing
$ dart_mutant
Discovering Dart files...
Found 12 files, 847 mutation candidates
Running mutation tests [████████████████████] 847/847
Mutation Score: 87.2%
Killed: 739 Survived: 108
Why dart_mutant?
Code coverage lies. A line can be "covered" without being tested. Mutation testing reveals the truth.
AST-Based Mutations
Unlike regex-based tools, dart_mutant parses your code into an AST using tree-sitter. Only valid, meaningful mutations that compile.
Parallel Execution
Written in Rust. Mutants are tested in parallel across available CPU cores so large codebases remain practical to mutation-test.
Smart Exclusions
Generated files (*.g.dart, *.freezed.dart), comments, and
string literals are excluded by default, so surviving mutants reflect real gaps.
Beautiful Reports
Dark-themed HTML reports with per-file breakdown. See exactly which mutations survived and where to add tests.
CI/CD Ready
JUnit XML output, threshold enforcement, and quiet mode. Fail builds when mutation score drops below target.
AI-Powered (Optional)
Use Claude or local LLMs to identify high-value mutation locations. Focus testing where it matters most.
How It Works
Mutation testing injects bugs into your code to verify your tests catch them.
Parse Your Code
dart_mutant scans your lib/ directory and builds an AST for each Dart file
using tree-sitter. Generated files (*.g.dart, *.freezed.dart)
are automatically excluded.
Generate Mutations
The AST is walked to find mutation candidates: arithmetic operators, comparisons, boolean literals, null-safety operators, and more. Each mutation is a small, targeted change.
Run Tests
For each mutation, dart_mutant modifies the source, runs dart test, and
checks if any test fails. Mutations are tested in parallel for speed.
Report Results
Killed mutations = your tests caught the bug. Survived mutations = your tests missed it. The mutation score shows your true test effectiveness.
40+ Mutation Operators
dart_mutant applies a comprehensive set of mutations to thoroughly test your test suite.
| Category | Mutations |
|---|---|
| Arithmetic |
+ → -, *
→ /, ++
→ --
|
| Comparison |
> → >=, ==
→ !=, <
→ <=
|
| Logical |
&& → ||, !
→ (removed)
|
| Null Safety |
?? → (removed), ?.
→ .
|
| Control Flow |
if(x) → if(true),
if(false)
|
| Literals |
true → false,
"string" → ""
|
Ready to Hunt Mutants?
Stop trusting code coverage. Start mutation testing your Dart projects today.