class TurboTests::Runner
def handle_messages
def handle_messages exited = 0 loop do message = @messages.pop case message[:type] when "example_passed" example = FakeExample.from_obj(message[:example]) @reporter.example_passed(example) when "group_started" @reporter.group_started(message[:group].to_struct) when "group_finished" @reporter.group_finished when "example_pending" example = FakeExample.from_obj(message[:example]) @reporter.example_pending(example) when "load_summary" message = message[:summary] # NOTE: notifications order and content is not guaranteed hence the fetch # and count increment tracking to get the latest accumulated load time @reporter.load_time = message[:load_time] if message.fetch(:count, 0) > @load_count when "example_failed" example = FakeExample.from_obj(message[:example]) @reporter.example_failed(example) @failure_count += 1 if fail_fast_met @threads.each(&:kill) break end when "message" @reporter.message(message[:message]) when "seed" when "close" when "error" @reporter.error_outside_of_examples @error = true when "exit" exited += 1 if exited == @num_processes break end else STDERR.puts("Unhandled message in main process: #{message}") end STDOUT.flush end rescue Interrupt end