class Minitest::Discard

Attributes

original_result[R]

Public Class Methods

new(message, original_result:) click to toggle source
Calls superclass method
# File lib/minitest/distributed/result_type.rb, line 12
def initialize(message, original_result:)
  @original_result = original_result
  super(message)
end
wrap(result, test_timeout_seconds:) click to toggle source
# File lib/minitest/distributed/result_type.rb, line 23
def self.wrap(result, test_timeout_seconds:)
  message = +"This test result was discarded, because it could not be committed to the test run coordinator."
  if result.time > test_timeout_seconds
    message << format(
      "\n\nThe test took %0.3fs to run, longer than the test timeout which is configured to be %0.1fs.\n" \
      "Another worker likely claimed ownership of this test, and will commit the result instead.\n" \
      "For best results, make sure that all your tests finish within %0.1fs.",
      result.time, test_timeout_seconds, test_timeout_seconds
    )
  end

  discard_assertion = Minitest::Discard.new(message, original_result: result)
  discard_assertion.set_backtrace(caller)
  discarded_result = result.dup
  discarded_result.failures = [discard_assertion]
  discarded_result
end

Public Instance Methods

result_label() click to toggle source
# File lib/minitest/distributed/result_type.rb, line 18
def result_label
  "Discarded"
end