Module: Minitest::Reporters::Ws::Formatting
- Included in:
- Reporter
- Defined in:
- lib/minitest/reporters/ws/formatting.rb
Constant Summary collapse
- INFO_PADDING =
8
Instance Method Summary collapse
- #err_info(e) ⇒ Object
- #get_description(runner, test) ⇒ Object
- #pad(str, size) ⇒ Object
- #print_after_suite(suite) ⇒ Object
- #print_after_suites ⇒ Object
- #print_err(suite, test, test_runner) ⇒ Object
- #print_fail(suite, test, test_runner) ⇒ Object
- #print_info(e) ⇒ Object
-
#print_pass(suite, test, test_runner) ⇒ Object
TODO: fix printing.
- #print_skip(suite, test, test_runner) ⇒ Object
- #print_time(test) ⇒ Object
- #print_with_info_padding(line) ⇒ Object
Instance Method Details
#err_info(e) ⇒ Object
64 65 66 67 68 69 70 71 72 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 64 def err_info(e) err = "" e..each_line { |line| err += "<p>#{line}</p>" } trace = filter_backtrace(e.backtrace) trace.each { |line| err += "<p>#{line}</p>" } err end |
#get_description(runner, test) ⇒ Object
5 6 7 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 5 def get_description(runner, test) "#{test.suite}: <b>#{test.test}</b>" end |
#pad(str, size) ⇒ Object
74 75 76 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 74 def pad(str, size) ' ' * size + str end |
#print_after_suite(suite) ⇒ Object
47 48 49 50 51 52 53 54 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 47 def print_after_suite(suite) puts "#{@test_count} Tests - #{suite}" %w(P E F S).each do |status| print("#{@emoji[status]} => " + @emoji[status]*@results[status] + " #{@results[status]}") puts; end puts; end |
#print_after_suites ⇒ Object
56 57 58 59 60 61 62 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 56 def print_after_suites puts "FINISHED - #{runner.test_count} tests ran" %w(P E F S).each do |status| print("#{@emoji[status]} => " + @emoji[status]*@suites_results[status] + " #{@suites_results[status]}") puts; end end |
#print_err(suite, test, test_runner) ⇒ Object
41 42 43 44 45 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 41 def print_err(suite, test, test_runner) puts @emoji['E'] + red { " ERROR #{suite}" } puts red { " #{print_time(test)} #{test}" } puts print_info(test_runner.exception) unless @client.connected? end |
#print_fail(suite, test, test_runner) ⇒ Object
35 36 37 38 39 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 35 def print_fail(suite, test, test_runner) puts @emoji['F'] + red { " FAIL #{suite}" } puts red { " #{print_time(test)} #{test}" } puts print_info(test_runner.exception) unless @client.connected? end |
#print_info(e) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 14 def print_info(e) e..each_line { |line| print_with_info_padding(line) } trace = filter_backtrace(e.backtrace) trace.each { |line| print_with_info_padding(line) } end |
#print_pass(suite, test, test_runner) ⇒ Object
TODO: fix printing
23 24 25 26 27 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 23 def print_pass(suite, test, test_runner) unless @client.connected? # do nothing end end |
#print_skip(suite, test, test_runner) ⇒ Object
29 30 31 32 33 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 29 def print_skip(suite, test, test_runner) puts @emoji['S'] + yellow { " SKIP #{suite}" } puts yellow { " #{print_time(test)} #{test}" } puts print_info(test_runner.exception) unless @client.connected? end |
#print_time(test) ⇒ Object
9 10 11 12 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 9 def print_time(test) total_time = Time.now - (runner.test_start_time || Time.now) " (%.2fs)" % total_time end |
#print_with_info_padding(line) ⇒ Object
78 79 80 |
# File 'lib/minitest/reporters/ws/formatting.rb', line 78 def print_with_info_padding(line) puts pad(line, INFO_PADDING) end |