Skip to content

Commit

Permalink
debug_reporter.rb - remove monkey patches
Browse files Browse the repository at this point in the history
Minitest::Runnable
Minitest::Reporters:DelegateReporter
  • Loading branch information
MSP-Greg authored and thomthom committed Jul 9, 2024
1 parent 038a837 commit bfbecda
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions src/testup/debug_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,55 +12,6 @@
require 'testup/minitest_setup.rb'
require 'testup/app_files.rb'


# Patching Minitest because we currently use 5.4.3 which doesn't have `prerecord`.
module Minitest
class Runnable

class << self # rubocop:disable Style/MultilineIfModifier
puts "Alias old_run_one_method..."
alias_method :old_run_one_method, :run_one_method
end unless respond_to?(:old_run_one_method)

def self.run_one_method(klass, method_name, reporter)
reporter.prerecord(klass, method_name) if reporter.respond_to?(:prerecord)
self.old_run_one_method(klass, method_name, reporter)
end

##
# About to start running a test. This allows a reporter to show
# that it is starting or that we are in the middle of a test run.
def prerecord(klass, method_name)
end

end

class CompositeReporter < AbstractReporter
def prerecord(klass, method_name)
self.reporters.each do |reporter|
reporter.prerecord(klass, method_name) if reporter.respond_to?(:prerecord)
end
end
end
end


# Patch minitest-reporter to support `prerecord`.
module Minitest
module Reporters
class DelegateReporter < Minitest::AbstractReporter

def prerecord(klass, method_name)
all_reporters.each do |reporter|
reporter.prerecord(klass, method_name) if reporter.respond_to?(:prerecord)
end
end

end
end
end


module TestUp
# Based on Minitest::SummaryReporter
class DebugReporter < Minitest::StatisticsReporter
Expand Down

0 comments on commit bfbecda

Please sign in to comment.