class Minitest::Reporters::ProgressReporter
@see gist.github.com/356945 paydro’s monkey-patch
@see github.com/jeffkreeftmeijer/fuubar Fuubar
monkey-patch.
Based upon Jeff Kreefmeijer’s Fuubar (MIT License) and paydro’s
Fuubar-like reporter with a progress bar.
def before_test(test)
def before_test(test) super if options[:verbose] puts puts("\n%s#%s" % [test_class(test), test.name]) end end
def color
def color @color ||= "green" end
def color=(color)
def color=(color) @color = color @progress.progress_mark = send(color, PROGRESS_MARK) end
def initialize(options = {})
def initialize(options = {}) super @detailed_skip = options.fetch(:detailed_skip, true) @progress = ProgressBar.create( total: total_count, starting_at: count, progress_mark: green(PROGRESS_MARK), remainder_mark: ' ', format: options.fetch(:format, ' %C/%c: [%B] %p%% %a, %e'), autostart: false ) end
def print_test_with_time(test)
def print_test_with_time(test) print(" %s#%s (%.2fs)" % [test_class(test), test.name, total_time]) end
def record(test)
def record(test) super return show if test.skipped? && !@detailed_skip if test.failure print "\e[0m\e[1000D\e[K" print_colored_status(test) print_test_with_time(test) puts print_info(test.failure, test.error?) puts end if test.skipped? && color != "red" self.color = "yellow" elsif test.failure self.color = "red" end show end
def report
def report super @progress.finish puts puts('Finished in %.5fs' % total_time) print('%d tests, %d assertions, ' % [count, assertions]) color = failures.zero? && errors.zero? ? :green : :red print(send(color) { '%d failures, %d errors, ' } % [failures, errors]) print(yellow { '%d skips' } % skips) puts end
def show
def show @progress.increment unless count == 0 end
def start
def start super puts('Started with run options %s' % options[:args]) puts @progress.start @progress.total = total_count show end