Mewt
Mewt is a mutation testing tool. Mutation testing works by making small
changes (mutations) to your source code — like replacing + with - or
swapping true for false — and then running your test suite against each
change. If your tests still pass after a mutation, that's a gap: the mutant
"survived," meaning your tests didn't catch the change.
This tells you something code coverage alone can't: not just whether your tests execute a line, but whether they'd actually fail if that line were wrong.
Supported languages:
- Go
- JavaScript/TypeScript
- Rust
- Solidity
For details on how campaigns work under the hood, see How it works. To add support for a new language, see Adding a language.
Installation
Prebuilt binaries (recommended)
|
To build from source instead, see Building from source.
Quick start
- Mutate a single file (auto-detected language):
- Mutate all supported files in a directory (recursive):
- List available mutation slugs for a language:
- Print all mutants for a target path:
- Show mutation test results (optionally filtered by target):
- Test all mutants even if more severe ones were uncaught (disable skip optimization):
Configuration
Mewt reads configuration from the nearest mewt.toml found by walking up from the current working directory. CLI flags override config file values.
See Configuration for the full reference and src/example.toml for a commented example.
Examples
This repo includes example files you can try:
- Go:
tests/go/examples/hello-world.go - JavaScript/TypeScript:
tests/javascript/examples/simple.js - Rust:
tests/rust/examples/hello-world.rs - Solidity:
tests/solidity/examples/hello-world.sol
Notes
- Mixed-language projects are supported. When a directory is targeted, only files with supported extensions are considered.