Track and rerun failed Minitest tests with ease. Never manually hunt for failing tests again!
- 🎯 Failure Tracking: Automatically tracks failing tests
- 🔄 Selective Reruns: Run only the tests that failed in the previous run
- 🛤️ Rails Integration: Rake tasks for Rails projects
- 🚀 Simple CLI: Basic command-line interface
Add this line to your application's Gemfile:
gem 'minitest-rerun', group: :test
And then execute:
$ bundle install
For Rails projects, the gem automatically provides rake tasks.
$ minitest-rerun-failed exec
$ minitest-rerun-failed exec "test/models/**/*_test.rb" # Custom pattern
$ minitest-rerun-failed rerun
$ minitest-rerun-failed failed
$ minitest-rerun-failed clear
The gem automatically integrates with Rails. When you run rails test
, failures are automatically tracked.
You also get additional rake tasks:
$ rails test # Automatically tracks failures
$ rake test:rerun_track # Run tests with failure tracking
$ rake test:rerun # Rerun failed tests
$ rake test:rerun_failed # List failing tests
$ rake test:rerun_clear # Clear failure history
Here's a typical development workflow:
# 1. Run your test suite
$ minitest-rerun-failed exec
# Tests run, some fail...
# 2. Fix the failing tests
$ vim test/models/user_test.rb
# 3. Run only the tests that failed
$ minitest-rerun-failed rerun
# 4. Run the full suite to make sure nothing broke
$ minitest-rerun-failed exec
The gem supports basic configuration:
MinitestRerunFailed.configure do |config|
config.track_failures = true
config.failure_file = ".minitest-failures.json"
config.pattern = "test/**/*_test.rb"
end
Option | Default | Description |
---|---|---|
track_failures |
true |
Automatically track test failures |
failure_file |
.minitest-failures.json |
File to store failure data |
pattern |
test/**/*_test.rb |
Test file pattern |
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests.
To install this gem onto your local machine, run bundle exec rake install
.
Bug reports and pull requests are welcome on GitHub.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request
The gem is available as open source under the terms of the MIT License.