Skip to content

Commit

Permalink
Merge branch 'main' into ming/release-2.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
zhming0 committed Sep 9, 2024
2 parents 20d262b + 7eacf8a commit a33781f
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions lib/buildkite/test_collector/library_hooks/rspec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,20 @@
# The _buildkite prefix here is added as a safeguard against name collisions
# as we are in the main thread
Thread.current[:_buildkite_tracer] = tracer
example.run
Thread.current[:_buildkite_tracer] = nil

tracer.finalize

trace = Buildkite::TestCollector::RSpecPlugin::Trace.new(example, history: tracer.history)
Buildkite::TestCollector.uploader.traces[example.id] = trace
# It's important to use begin/ensure here, because otherwise if other hooks fail,
# the cleanup code won't run, meaning we will miss some data.
#
# Having said that, this behavior isn't documented by RSpec.
begin
example.run
ensure
Thread.current[:_buildkite_tracer] = nil

tracer.finalize

trace = Buildkite::TestCollector::RSpecPlugin::Trace.new(example, history: tracer.history)
Buildkite::TestCollector.uploader.traces[example.id] = trace
end
end

config.after(:suite) do
Expand Down

0 comments on commit a33781f

Please sign in to comment.