lib/parallel_tests/cli.rb in parallel_tests-1.3.0 vs lib/parallel_tests/cli.rb in parallel_tests-1.3.1

- old
+ new

@@ -188,12 +188,18 @@ abort if results.any? { |r| r[:exit_status] != 0 } end def report_time_taken - start = Time.now - yield - puts "\nTook #{Time.now - start} seconds" + seconds = ParallelTests.delta { yield }.to_i + puts "\nTook #{seconds} seconds#{detailed_duration(seconds)}" + end + + def detailed_duration(seconds) + parts = [ seconds / 3600, seconds % 3600 / 60, seconds % 60 ].drop_while(&:zero?) + return if parts.size < 2 + parts = parts.map { |i| "%02d" % i }.join(':').sub(/^0/, '') + " (#{parts})" end def final_fail_message fail_message = "#{@runner.name}s Failed" fail_message = "\e[31m#{fail_message}\e[0m" if use_colors?