Skip to content

Instantly share code, notes, and snippets.

@zenspider
Created July 23, 2024 18:17
Show Gist options
  • Save zenspider/fdd928459475683c92c1008d66a0b3ef to your computer and use it in GitHub Desktop.
Save zenspider/fdd928459475683c92c1008d66a0b3ef to your computer and use it in GitHub Desktop.
diff -r old/lib/minitest/rake_reporter.rb new/lib/minitest/rake_reporter.rb
--- old/lib/minitest/rake_reporter.rb
+++ new/lib/minitest/rake_reporter.rb
@@ -2,9 +2,16 @@
module Minitest
class RakeReporter < SprintReporter
+ attr_accessor :name
+
+ def initialize name = nil
+ self.results = []
+ self.name = name
+ end
+
def print_list
results.each do |result|
- puts " rake N=#{result.class_name}##{result.name}"
+ puts [" rake", name, "N=#{result.class_name}##{result.name}"].compact.join(" ")
end
end
end
diff -r old/lib/minitest/sprint_plugin.rb new/lib/minitest/sprint_plugin.rb
--- old/lib/minitest/sprint_plugin.rb
+++ new/lib/minitest/sprint_plugin.rb
@@ -2,8 +2,9 @@
module Minitest
def self.plugin_sprint_options opts, options # :nodoc:
- opts.on "--rake", "Report how to re-run failures with rake." do
+ opts.on "--rake [TASK]", "Report how to re-run failures with rake." do |task|
options[:sprint] = :rake
+ options[:rake_task] = task
end
opts.on "--binstub", "Report how to re-run failures with minitest." do
@@ -15,7 +16,7 @@
case options[:sprint]
when :rake then
require "minitest/rake_reporter"
- self.reporter << Minitest::RakeReporter.new
+ self.reporter << Minitest::RakeReporter.new(options[:rake_task])
when :binstub then
require "minitest/binstub_reporter"
self.reporter << Minitest::BinstubReporter.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment