Module: Buildkite::TestCollector::MinitestPlugin

Included in:
Minitest::Test
Defined in:
lib/buildkite/test_collector/minitest_plugin.rb,
lib/buildkite/test_collector/minitest_plugin/trace.rb,
lib/buildkite/test_collector/minitest_plugin/reporter.rb

Defined Under Namespace

Classes: Reporter, Trace

Instance Method Summary collapse

Instance Method Details

#after_teardownObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/buildkite/test_collector/minitest_plugin.rb', line 22

def after_teardown
  tracer = Thread.current[:_buildkite_tracer]
  if !tracer.nil?
    Thread.current[:_buildkite_tracer] = nil
    tracer.finalize

    trace = Buildkite::TestCollector::MinitestPlugin::Trace.new(self, history: tracer.history)
    Buildkite::TestCollector.uploader.traces[trace.source_location] = trace
  end

  super
end

#before_setupObject



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/buildkite/test_collector/minitest_plugin.rb', line 10

def before_setup
  super

  tracer = Buildkite::TestCollector::Tracer.new(
    min_duration: Buildkite::TestCollector.trace_min_duration,
  )

  # The _buildkite prefix here is added as a safeguard against name collisions
  # as we are in the main thread
  Thread.current[:_buildkite_tracer] = tracer
end