Project

mutaterb

0.0
The project is in a healthy, maintained state
Detects weak tests by mutating source code covered by an RSpec suite and checking whether the suite catches the mutation.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13
~> 3.13
~> 1.65
 Project Readme

MutateRB

A mutation testing tool for Ruby and Ruby on Rails projects: it modifies code covered by your test suite and checks whether it catches the change. If a mutated test does not fail, that test is identified as weak. Supports both RSpec and Minitest.

Installation

gem install mutaterb

Or add it to your Gemfile:

gem "mutaterb", group: :development

Usage

Run the command from your project root (where your Gemfile is):

mutaterb

Without flags, it automatically detects whether the project is pure Ruby or Rails, which test framework it uses (RSpec if there's a spec/ folder, Minitest if there's a test/ folder — RSpec wins if both are present), applies mutations to covered code, and displays a summary: how many mutations were "killed" (caught by a test) and how many "survived" (no test caught them — weak tests), with file, line, and related test(s) for each survivor.

While it runs, it prints the baseline status and a live counter of mutants processed so far out of the total, so a long run never looks stuck. Pass --verbose to replace that counter with one line per mutant (file, line, mutation type, and result) as it is evaluated.

Main flags

Flag Description
--dir PATH Target folder to analyze
--include PATHS Restrict analysis to these paths (comma-separated)
--exclude PATHS Exclude these paths (comma-separated)
--strictness LEVEL low, default, or high
--framework FRAMEWORK auto, rspec, or minitest — forces the test framework instead of auto-detecting it
--mutation-types TYPES Mutation types to apply, comma-separated
--exit-zero Do not fail (exit 0) even if "survived" mutations exist
--verbose Print one line per mutant as it runs, instead of the default counter
--json-output PATH Export the results summary to a JSON file
--config PATH Use a config file other than .mutaterb.yml

You can also set these options in a .mutaterb.yml file at the project root; CLI flags take precedence over the file when both define the same option.

License

MIT — see LICENSE.txt.