Sha256: 7b558750eb22f1c32f4c54031532158f78bffc07534089e3b8436c5582b637d5

Contents?: true

Size: 657 Bytes

Versions: 2

Compression:

Stored size: 657 Bytes

Contents

# frozen_string_literal: true

require "subprocess"
require_relative "formatter"

module RSpec
  module Trace
    class OpenTelemetryFormatter < Formatter
      RSpec::Core::Formatters.register(
        self,
        :start,
        :example_group_started, :example_group_finished,
        :example_started, :example_passed, :example_pending, :example_failed,
        :stop
      )

      def initialize(output)
        @process = Subprocess::Process.new(["rspec-trace-consumer"], {stdin: Subprocess::PIPE})
        super(@process.stdin)
      end

      def stop(notification)
        super(notification)

        @process.wait
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rspec-trace-formatter-0.2.0 lib/rspec/trace/open_telemetry_formatter.rb
rspec-trace-formatter-0.1.0 lib/rspec/trace/open_telemetry_formatter.rb