Skip to content

Commit

Permalink
+ Added --show-skips option to show skips at end of run but not requi…
Browse files Browse the repository at this point in the history
…re --verbose. (MSP-Greg)

[git-p4: depot-paths = "//src/minitest/dev/": change = 13427]
  • Loading branch information
zenspider committed Jun 6, 2022
1 parent db0a2e3 commit 4b16c03
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
10 changes: 8 additions & 2 deletions lib/minitest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,10 @@ def self.process_args args = [] # :nodoc:
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
Expand Down Expand Up @@ -810,7 +814,8 @@ def statistics # :nodoc:

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] || []

Expand All @@ -831,7 +836,8 @@ def summary # :nodoc:
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]
Expand Down
33 changes: 28 additions & 5 deletions test/minitest/test_minitest_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,7 @@ def test_omg; assert true; end
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

Expand Down Expand Up @@ -537,6 +533,33 @@ def test_skip
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
Expand Down

0 comments on commit 4b16c03

Please sign in to comment.