module Minitest::Reporters::Ws::Messages
Public Instance Methods
add_to_erring(test)
click to toggle source
# File lib/minitest/reporters/ws/messages.rb, line 28 def add_to_erring(test) # for now, treating erring the same as failing client.send_msg(prep_result(test, :add_to_erring)) end
add_to_failing(test)
click to toggle source
# File lib/minitest/reporters/ws/messages.rb, line 24 def add_to_failing(test) client.send_msg(prep_result(test, :add_to_failing)) end
add_to_passing(test)
click to toggle source
# File lib/minitest/reporters/ws/messages.rb, line 16 def add_to_passing(test) client.send_msg(prep_result(test, :add_to_passing)) end
add_to_pending(test)
click to toggle source
# File lib/minitest/reporters/ws/messages.rb, line 20 def add_to_pending(test) client.send_msg(prep_result(test, :add_to_pending)) end
messages()
click to toggle source
# File lib/minitest/reporters/ws/messages.rb, line 4 def messages { start_new_iteration: { receiver: "web", method: "startNewIteration" }, add_to_passing: { receiver: "web", method: "addToPassing" }, add_to_pending: { receiver: "web", method: "addToPending" }, add_to_erring: { receiver: "web", method: "addToFailing" }, add_to_failing: { receiver: "web", method: "addToFailing" } } end
start_new_iteration(test_count = 420)
click to toggle source
# File lib/minitest/reporters/ws/messages.rb, line 12 def start_new_iteration(test_count = 420) client.send_msg(messages[:start_new_iteration].merge arguments: [@timestamp, test_count]) end
Private Instance Methods
example_to_hash(meta)
click to toggle source
TODO: fix formatting
# File lib/minitest/reporters/ws/messages.rb, line 42 def example_to_hash(meta) # the runner is the Minitest::Runner # which Minitest::Reporter modifies to work m = meta[:metadata] t = meta[:test] r = meta[:runner] ex = t.exception ? err_info(t.exception) : nil desc = get_description(r,t) #desc += ex if ex # TODO: format times { framework: :minitest, started_at: r.test_start_time, finished_at: Time.now, # convert to_i? & add? @timestamp + t.time run_time: t.time, file_path: "/mock/me/some/data", # not in minitest_reporters? line_number: 9876, # not in minitest_reporters? assertions: t.assertions, exception: ex || '', description: desc } end
prep_result(test, key)
click to toggle source
# File lib/minitest/reporters/ws/messages.rb, line 35 def prep_result(test, key) test_data = example_to_hash(test) messages[key].merge arguments: [@timestamp, test_data] end