Class: RSpec::Buildkite::Analytics::Reporter
- Inherits:
-
Object
- Object
- RSpec::Buildkite::Analytics::Reporter
- Defined in:
- lib/rspec/buildkite/analytics/reporter.rb
Instance Attribute Summary collapse
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
- #dump_summary(notification) ⇒ Object
- #handle_example(notification) ⇒ Object (also: #example_passed, #example_failed, #example_pending)
-
#initialize(output) ⇒ Reporter
constructor
A new instance of Reporter.
Constructor Details
#initialize(output) ⇒ Reporter
Returns a new instance of Reporter.
9 10 11 |
# File 'lib/rspec/buildkite/analytics/reporter.rb', line 9 def initialize(output) @output = output end |
Instance Attribute Details
#output ⇒ Object (readonly)
Returns the value of attribute output.
7 8 9 |
# File 'lib/rspec/buildkite/analytics/reporter.rb', line 7 def output @output end |
Instance Method Details
#dump_summary(notification) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rspec/buildkite/analytics/reporter.rb', line 26 def dump_summary(notification) if RSpec::Buildkite::Analytics.session.present? examples_count = { examples: notification.examples.count, failed: notification.failed_examples.count, pending: notification.pending_examples.count, errors_outside_examples: notification.errors_outside_of_examples_count } RSpec::Buildkite::Analytics.session.close(examples_count) # Write the debug file, if debug mode is enabled if RSpec::Buildkite::Analytics.debug_enabled filename = "#{RSpec::Buildkite::Analytics.debug_filepath}/bk-analytics-#{Time.now.strftime("%F-%R:%S")}-#{ENV["BUILDKITE_JOB_ID"]}.log.gz" File.open(filename, "wb") do |f| gz = Zlib::GzipWriter.new(f) gz.puts(RSpec::Buildkite::Analytics.session.logger.to_array) gz.close end end end end |
#handle_example(notification) ⇒ Object Also known as: example_passed, example_failed, example_pending
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rspec/buildkite/analytics/reporter.rb', line 13 def handle_example(notification) example = notification.example trace = RSpec::Buildkite::Analytics.uploader.traces.find do |trace| example.id == trace.example.id end if trace trace.example = example trace.failure_reason, trace. = failure_info(notification) if example.execution_result.status == :failed RSpec::Buildkite::Analytics.session&.write_result(trace) end end |