From 8dd55c3a6e2595bfd4ab5f8a7494b11d980b01d9 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Fri, 5 Jan 2024 10:44:24 -0600 Subject: [PATCH] debug_reporter.rb - remove monkey patches Minitest::Runnable Minitest::Reporters:DelegateReporter --- src/testup/debug_reporter.rb | 49 ------------------------------------ 1 file changed, 49 deletions(-) diff --git a/src/testup/debug_reporter.rb b/src/testup/debug_reporter.rb index 8b4201b..dfd173d 100644 --- a/src/testup/debug_reporter.rb +++ b/src/testup/debug_reporter.rb @@ -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