Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


master branch CI

Easy rerun of failed tests with minitest.

Example screenshot


  • Outputs all failed tests in short summary at end of test run.
    • To console and / or to file
    • Optionally includes line numbers
  • Lists seed of run for rerun.
  • [TODO] Executable for running only failed tests
    • Until then, use something like
      • ruby $(cat .minitest_failed_tests.txt)
      • bundle exec rails test $(cat .minitest_failed_tests.txt)


Add this line to your application's Gemfile:

gem 'minitest_rerun_failed'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install minitest_rerun_failed


Use it like any Minitest::Reporters like such:

Minitest::Reporters.use! [, # This is just my preferred reporter. Use the one(s) you like. true, include_line_numbers: true)


  • include_line_numbers: Include line numbers in outputs. Defaults to true
  • verbose: Output to stdout. Defaults to true
  • file_output: Output to file. Defaults to true
  • output_path: Path to place output files in. Defaults to '.'


Why line numbers instead of test names? What if the lines change as I am fixing things?

Line numbers were much easier to implement. If you find a good way to output test names instead, please open a PR with tests to add it as an option.

As for if line numbers change, the most likely outcome is that the whole file will simply be run instead of a single test. You can also use the option include_line_numbers: false to always output whole files for greater safety.


After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to


Bug reports and pull requests are welcome on GitHub at


The gem is available as open source under the terms of the MIT License.