Skip to content

Commit

Permalink
Propagates exit codes from other runners
Browse files Browse the repository at this point in the history
  • Loading branch information
alindeman committed Dec 30, 2013
1 parent a731790 commit 895b23e
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/multi_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ def self.disable_autorun
if defined?(Minitest)
Minitest.instance_eval do
def run(*)
0 # exit code
# propagate the exit code from cucumber or another runner
case $!
when SystemExit
$!.status
else
true
end
end
end

Expand Down
1 change: 1 addition & 0 deletions test/gemfiles/minitest-5.0.1/scenarios
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bundler_require.rb
minitest_propagate_exit_code.rb

1 change: 1 addition & 0 deletions test/gemfiles/minitest-5.1.0/scenarios
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bundler_require.rb
minitest_propagate_exit_code.rb

1 change: 1 addition & 0 deletions test/gemfiles/minitest-5.2.0/scenarios
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
bundler_require.rb
minitest_propagate_exit_code.rb

9 changes: 9 additions & 0 deletions test/scenarios/minitest_propagate_exit_code.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Imagine this is your rails app
require 'minitest/autorun'

# Now cucumber loads and exits successfully
require "multi_test"
MultiTest.disable_autorun
exit 0

# Our Minitest hook should propagate that healthy status code

0 comments on commit 895b23e

Please sign in to comment.