Class: Minitest::Queue::BuildStatusRecorder

Inherits:
Reporters::BaseReporter
  • Object
show all
Defined in:
lib/minitest/queue/build_status_recorder.rb

Constant Summary collapse

COUNTERS =
%w(
  assertions
  errors
  failures
  skips
  requeues
  total_time
).freeze

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build:, **options) ⇒ BuildStatusRecorder

Returns a new instance of BuildStatusRecorder.



23
24
25
26
27
28
29
30
31
# File 'lib/minitest/queue/build_status_recorder.rb', line 23

def initialize(build:, **options)
  super(options)

  @build = build
  self.failures = 0
  self.errors = 0
  self.skips = 0
  self.requeues = 0
end

Class Attribute Details

.failure_formatterObject

Returns the value of attribute failure_formatter.



17
18
19
# File 'lib/minitest/queue/build_status_recorder.rb', line 17

def failure_formatter
  @failure_formatter
end

Instance Attribute Details

#requeuesObject

Returns the value of attribute requeues.



21
22
23
# File 'lib/minitest/queue/build_status_recorder.rb', line 21

def requeues
  @requeues
end

Instance Method Details

#record(test) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/minitest/queue/build_status_recorder.rb', line 37

def record(test)
  super

  self.total_time = Minitest.clock_time - start_time
  if test.requeued?
    self.requeues += 1
  elsif test.skipped?
    self.skips += 1
  elsif test.error?
    self.errors += 1
  elsif test.failure
    self.failures += 1
  end

  stats = COUNTERS.zip(COUNTERS.map { |c| send(c) }).to_h
  if (test.failure || test.error?) && !test.skipped?
    build.record_error("#{test.klass}##{test.name}", dump(test), stats: stats)
  else
    build.record_success("#{test.klass}##{test.name}", stats: stats, skip_flaky_record: test.skipped?)
  end
end

#reportObject



33
34
35
# File 'lib/minitest/queue/build_status_recorder.rb', line 33

def report
  # noop
end