âš¡ Powered by Rust & tree-sitter

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.

terminal
# 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
Mutation Score 87.2%
739 Killed 108 Survived 0 Timeout

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.

1

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.

2

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.

3

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.

4

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" → ""

View All Operators →

40+
Mutation Operators
AST
tree-sitter parsing
MIT
Open Source License
Dart 3
Null-safety support

Ready to Hunt Mutants?

Stop trusting code coverage. Start mutation testing your Dart projects today.