An rspec formatter that shows elapsed time, example count, example description, and example location, with no scrolling except for errors.
Compatible with rspec 3.1
Output looks something like this:
$ rspec spec --format RspecNumberingFormatter 5678 examples 3:18 3999 A Widget when updated should not show widget status unless fa /spec/models/widgets/widget_update_spec.rb:42
This formatter uses ANSI escape sequences to overwrite and re-use the same line so you do not get massive amounts of information scrolling past; you just see where you are in the process, and how much time has elapsed so far.
A problem with the otherwise-excellent "progress" formatter arises when you have a large number of examples taking a long time to run (like, anything more than sixty seconds). You see a red "F" in the output, but you have to wait till the end of the process to see what the problem is.
Another problem is that when you have zillions of examples, the "progress" formatter turns your terminal into a sea of dots, and it's hard to know when your run will be finished. This format prints the elapsed time along with the example count at the beginning of each line, the better to help you judge how long you need to wait before hitting the magic DEPLOY button.
This formatter outputs failure information immediately so you can proceed with fixing instead of twiddling your thumbs or browsing your favourite social site while your test suite hums away in the background. This formatter means you can be more efficient while coding. Basically, it makes you a better person. You should start using this formatter now.
Note: (seriously) if your main project has 6,000 rspec examples, like mine does, it's probably pathological, and you should probably refactor, as I should. This formatter can help you cope while you're waiting for the doctor.
Note: this formatter is less helpful when used together with parallel_tests. Everything still works, but you lose that smooth satisfying sense of progress because you're getting output from N threads all on top of each other at once.
Add these lines to your application's Gemfile:
group :test do gem 'rspec_numbering_formatter' end
And then execute:
Run rspec thus:
$ bundle exec rspec spec --format RspecNumberingFormatter
Enjoy the immediate boost to your productivity.
0.1.0: upgrade to depend on rspec 3.1
- 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