Hunt Down Weak Tests
dart_mutant unleashes mutations on your Dart code to find tests that pass when they shouldn't. AST-based precision. Zero false positives. Blazing fast.
# 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.
Blazingly Fast
Written in Rust with parallel test execution. Mutation test your entire codebase in minutes, not hours.
Zero False Positives
Smart exclusions for generated code, comments, and strings. Every surviving mutant is a real gap in your tests.
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.