+ Added --show-skips option to show skips at end of run but not require --verbose. (MSP-Greg)

[git-p4: depot-paths = "//src/minitest/dev/": change = 13427]
This commit is contained in:
Ryan Davis 2022-06-05 21:05:06 -08:00
parent db0a2e3154
commit 4b16c03764
2 changed files with 36 additions and 7 deletions

View File

@ -213,6 +213,10 @@ module Minitest
options[:verbose] = true
end
opts.on "--show-skips", "Show skipped at the end of run." do
options[:show_skips] = true
end
opts.on "-n", "--name PATTERN", "Filter run on /regexp/ or string." do |a|
options[:filter] = a
end
@ -810,7 +814,8 @@ module Minitest
def aggregated_results io # :nodoc:
filtered_results = results.dup
filtered_results.reject!(&:skipped?) unless options[:verbose]
filtered_results.reject!(&:skipped?) unless
options[:verbose] or options[:show_skips]
skip = options[:skip] || []
@ -831,7 +836,8 @@ module Minitest
extra = ""
extra = "\n\nYou have skipped tests. Run with --verbose for details." if
results.any?(&:skipped?) unless options[:verbose] or ENV["MT_NO_SKIP_MSG"]
results.any?(&:skipped?) unless
options[:verbose] or options[:show_skips] or ENV["MT_NO_SKIP_MSG"]
"%d runs, %d assertions, %d failures, %d errors, %d skips%s" %
[count, assertions, failures, errors, skips, extra]

View File

@ -164,11 +164,7 @@ class TestMinitestUnit < MetaMetaMetaTestCase
end
def util_expand_bt bt
if RUBY_VERSION >= "1.9.0" then
bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
else
bt
end
bt.map { |f| (f =~ /^\./) ? File.expand_path(f) : f }
end
end
@ -537,6 +533,33 @@ class TestMinitestRunner < MetaMetaMetaTestCase
assert_report expected, %w[--seed 42 --verbose]
end
def test_run_skip_show_skips
@tu =
Class.new FakeNamedTest do
def test_something
assert true
end
def test_skip
skip "not yet"
end
end
expected = clean <<-EOM
.S
Finished in 0.00
1) Skipped:
FakeNamedTestXX#test_skip [FILE:LINE]:
not yet
2 runs, 1 assertions, 0 failures, 0 errors, 1 skips
EOM
assert_report expected, %w[--seed 42 --show-skips]
end
def test_run_with_other_runner
@tu =
Class.new FakeNamedTest do