module Minitest

Public Class Methods

plugin_focus_options(_opts, options) click to toggle source
# File lib/minitest/focus_plugin.rb, line 4
def self.plugin_focus_options(_opts, options)
  return unless Minitest::Test.respond_to? :filtered_names
  return if Minitest::Test.filtered_names.empty?

  index = ARGV.index { |arg| arg =~ /^-n/ || arg =~ /^--name/ }
  if index
    warn 'Ignoring -n / --name, using `focus` filters instead'
    ARGV.delete_at index
  end

  re = "/^(#{Regexp.union(Minitest::Test.filtered_names).source})$/"

  options[:filter] = re
end