Class: Minitest::Reporters::ProgressReporter
- Inherits:
-
BaseReporter
- Object
- StatisticsReporter
- BaseReporter
- Minitest::Reporters::ProgressReporter
- Includes:
- ANSI::Code, Minitest::RelativePosition
- Defined in:
- lib/minitest/reporters/progress_reporter.rb
Overview
Fuubar-like reporter with a progress bar.
Based upon Jeff Kreefmeijer's Fuubar (MIT License) and paydro's monkey-patch.
Constant Summary collapse
- INFO_PADDING =
2
Constants included from Minitest::RelativePosition
Minitest::RelativePosition::MARK_SIZE, Minitest::RelativePosition::TEST_PADDING, Minitest::RelativePosition::TEST_SIZE
Instance Attribute Summary
Attributes inherited from BaseReporter
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ ProgressReporter
constructor
A new instance of ProgressReporter.
- #record(test)
- #report
- #start
Methods inherited from BaseReporter
#add_defaults, #after_test, #before_test
Constructor Details
#initialize(options = {}) ⇒ ProgressReporter
Returns a new instance of ProgressReporter.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/minitest/reporters/progress_reporter.rb', line 19 def initialize( = {}) super @detailed_skip = .fetch(:detailed_skip, true) @progress = PowerBar.new(:msg => "0/#{count}") @progress.settings.tty.finite.output = lambda { |s| print(s) } @progress.settings.tty.finite.template. = "=" @progress.settings.tty.finite.template.padchar = " " @progress.settings.tty.finite.template.pre = "\e[1000D\e[?25l#{GREEN}" @progress.settings.tty.finite.template.post = CLEAR end |
Instance Method Details
#record(test)
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/minitest/reporters/progress_reporter.rb', line 38 def record(test) super if (test.skipped? && @detailed_skip) || test.failure wipe print_colored_status(test) print_test_with_time(test) puts print_info(test.failure, test.error?) if test.failure puts end if test.skipped? && color != RED self.color = YELLOW elsif test.failure self.color = RED end show end |
#report
58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/minitest/reporters/progress_reporter.rb', line 58 def report super @progress.close wipe puts puts('Finished in %.5fs' % total_time) print('%d tests, %d assertions, ' % [count, assertions]) print(red { '%d failures, %d errors, ' } % [failures, errors]) print(yellow { '%d skips' } % skips) puts end |
#start
31 32 33 34 35 36 |
# File 'lib/minitest/reporters/progress_reporter.rb', line 31 def start super puts 'Started' puts show end |