Sha256: e4e62aeaf64d4cda7d189c0108151f077156c717f4b3ee09cda1f4af80011cb2

Contents?: true

Size: 1005 Bytes

Versions: 7

Compression:

Stored size: 1005 Bytes

Contents

# frozen_string_literal: true

require "rspec/core"
require "rspec/expectations"

require_relative "../rspec_plugin/reporter"
require_relative "../rspec_plugin/trace"

Buildkite::TestCollector.uploader = Buildkite::TestCollector::Uploader

RSpec.configure do |config|
  config.before(:suite) do
    config.add_formatter Buildkite::TestCollector::RSpecPlugin::Reporter

    Buildkite::TestCollector.safe { Buildkite::TestCollector::Uploader.configure }
  end

  config.around(:each) do |example|
    tracer = Buildkite::TestCollector::Tracer.new

    # 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
  end
end

Buildkite::TestCollector.enable_tracing!

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
buildkite-test_collector-1.3.1 lib/buildkite/test_collector/library_hooks/rspec.rb
buildkite-test_collector-1.3.0 lib/buildkite/test_collector/library_hooks/rspec.rb
buildkite-test_collector-1.2.5 lib/buildkite/test_collector/library_hooks/rspec.rb
buildkite-test_collector-1.2.4 lib/buildkite/test_collector/library_hooks/rspec.rb
buildkite-test_collector-1.2.3 lib/buildkite/test_collector/library_hooks/rspec.rb
buildkite-test_collector-1.1.3 lib/buildkite/test_collector/library_hooks/rspec.rb
buildkite-test_collector-1.1.2 lib/buildkite/test_collector/library_hooks/rspec.rb