DEV: Remove direct minitest dependency to appease ruby-lsp (#26056)

Having minitest as a direct dependency causes ruby-lsp to use it as our test runner (per https://github.com/Shopify/ruby-lsp/blob/d1da8858a1/lib/ruby_lsp/requests/support/dependency_detector.rb#L40-L55). This makes VSCode's test explorer incorrectly display Minitest 'run' buttons above all our tests.

We were only using it in `emoji.rake`... and that wasn't even working with the latest version of Minitest. This commit refactors `emoji.rake` to work without minitest, and removes the dependency.
This commit is contained in:
David Taylor 2024-03-06 15:41:14 +00:00 committed by GitHub
parent 65c6909419
commit dfc6bb4029
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 7 deletions

View File

@ -125,7 +125,6 @@ group :test do
gem "capybara", require: false
gem "webmock", require: false
gem "fakeweb", require: false
gem "minitest", require: false
gem "simplecov", require: false
gem "selenium-webdriver", "~> 4.14", require: false
gem "selenium-devtools", require: false

View File

@ -602,7 +602,6 @@ DEPENDENCIES
mini_sql
mini_suffix
minio_runner
minitest
mocha
multi_json
mustache

View File

@ -475,12 +475,27 @@ def confirm_overwrite(path)
STDIN.gets.chomp
end
class TestEmojiUpdate < Minitest::Test
class TestEmojiUpdate
def self.run_and_summarize
puts "Runnings tests..."
reporter = Minitest::SummaryReporter.new
TestEmojiUpdate.run(reporter)
puts reporter
puts "Running tests..."
instance = TestEmojiUpdate.new
instance.public_methods.each do |method|
next unless method.to_s.start_with? "test_"
print "Running #{method}..."
instance.public_send(method)
puts ""
rescue StandardError => e
puts ""
puts e.message.indent(2)
end
end
def assert_equal(a, b)
raise "Expected #{a.inspect} to equal #{b.inspect}" if a != b
end
def assert(a)
raise "Expected #{a.inspect} to be truthy" if !a
end
def image_path(style, name)