Skip to content

Commit

Permalink
separate out failed example handler with logging
Browse files Browse the repository at this point in the history
  • Loading branch information
niceking committed Sep 12, 2023
1 parent c57c586 commit 58df081
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion lib/buildkite/test_collector/rspec_plugin/reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,32 @@ def handle_example(notification)
end
end

def handle_failed_example(notification)
$stdout.puts "start of handle_failed_example"
example = notification.example
trace = Buildkite::TestCollector.uploader.traces[example.id]
$tstoud.puts "example id: #{example.id}"

if trace
$stdout.puts "found trace"
trace.example = example
$stdout.puts "execution result: #{example.execution_result}"
if example.execution_result.status == :failed
trace.failure_reason, trace.failure_expanded = failure_info(notification)
end
$stdout.puts "adding example to queue"
Buildkite::TestCollector.session.add_example_to_send_queue(example.id)
end
$stdout.puts "end of handle_failed_example"
end

def dump_summary(_notification)
Buildkite::TestCollector.session.send_remaining_data
Buildkite::TestCollector.session.close
end

alias_method :example_passed, :handle_example
alias_method :example_failed, :handle_example
alias_method :example_failed, :handle_failed_example
alias_method :example_pending, :handle_example

private
Expand Down

0 comments on commit 58df081

Please sign in to comment.