Skip to content

Commit

Permalink
Change test runner on --fail-fast to report first error deterministic…
Browse files Browse the repository at this point in the history
…ally
  • Loading branch information
mbj committed May 11, 2024
1 parent 363ccf2 commit 285af32
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion lib/mutant/reporter/cli/printer/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class EnvResult < self
#
# @return [undefined]
def run
visit_collection(Result, object.failed_test_results)
visit_failed
visit(Env, object.env)
FORMATS.each do |report, format, value|
__send__(report, format, __send__(value))
Expand All @@ -77,6 +77,32 @@ def run

private

def visit_failed
failed = object.failed_test_results

if object.env.config.fail_fast
visit_failed_tests(failed.take(1))
visit_other_failed(failed.drop(1))
else
visit_failed_tests(failed)
end
end

def visit_other_failed(other)
return if other.empty?

puts(
colorize(
Unparser::Color::RED,
'Other failed tests (report suppressed from fail fast): %d' % other.length
)
)
end

def visit_failed_tests(failed)
visit_collection(Result, failed)
end

def efficiency_percent
(testtime / runtime) * 100
end
Expand Down

0 comments on commit 285af32

Please sign in to comment.