Last active
December 20, 2015 16:18
-
-
Save dup2/6160098 to your computer and use it in GitHub Desktop.
Add a simple fail-fast option to minitest/turn/minitest-rails
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to your "test_helper.rb" or "minitest_helper.rb" | |
# | |
# Example: | |
# FAIL_FAST=true rake minitest | |
# | |
# Add this to your Gemfile: | |
# group :test do | |
# gem 'minitest' | |
# gem 'minitest-rails' | |
# gem 'turn' | |
# end | |
# This allows for fast failure within our turn environment | |
# - Turn hooks into minitest with a custom runner class | |
# - Turn has it's own reporter which we use to output a message | |
class << MiniTest::Unit.runner; self; end.class_eval do | |
def puke(suite, test, e) | |
super(suite, test, e) | |
if ENV['FAIL_FAST'] && !e.kind_of?(MiniTest::Skip) | |
turn_reporter.io.puts "****** Fail fast active for tests, exiting (environment variable FAIL_FAST exists)" | |
exit(1) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment