Skip to content

Commit

Permalink
+ Added "did you mean" output if your --name filter matches nothing. …
Browse files Browse the repository at this point in the history
…(tenderlove)

[git-p4: depot-paths = "//src/minitest/dev/": change = 14038]
  • Loading branch information
zenspider committed Jan 26, 2024
1 parent ef83965 commit ebb468c
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/minitest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,33 @@ def self.run args = []
warn "Interrupted. Exiting..."
end
self.parallel_executor.shutdown

# might have been removed/replaced during init_plugins:
summary = reporter.reporters.grep(SummaryReporter).first
return empty_run! options if summary && summary.count == 0

reporter.report

reporter.passed?
end

def self.empty_run! options # :nodoc:
filter = options[:filter]

warn "Nothing ran for filter: %s" % [filter]

require "did_you_mean" # soft dependency, punt if it doesn't load

ms = Runnable.runnables.flat_map(&:runnable_methods)
cs = DidYouMean::SpellChecker.new(dictionary: ms).correct filter

warn DidYouMean::Formatter.message_for cs unless cs.empty?
rescue LoadError
# do nothing
ensure
false
end

##
# Internal run method. Responsible for telling all Runnable
# sub-classes to run.
Expand Down

0 comments on commit ebb468c

Please sign in to comment.