Reputation: 6777
I checked rails test -h
but I do not see an option to suppress output for skipped tests. I have a few that need to be skipped and it's hard to wade through the output. I really only want to see the failures, to be honest, and then a summary at the bottom.
Am simply adding the:
test "my broken test" do
skip("I know this test is broken, ignore it for now.")
do
In the console output, each skipped test is output in the same way an error would be (only it's marked as SKIP
). The summary is really all I want to see
1358 tests, 28 assertions, 0 failures, 0 errors, 1340 skips
Thanks!
Upvotes: 0
Views: 814
Reputation: 4055
If you use the minitest-reporters gem you can explicitly supress skipped tests:
Minitest::Reporters.use!([
Minitest::Reporters::DefaultReporter.new(detailed_skip: false),
])
Upvotes: 0
Reputation: 46379
I don't know if there's an official way, but I can think of two workarounds.
One would be to write a custom reporter.
The other would be to make your own skip function in TestCase (in test/test_helper.rb
), something like this:
class ActiveSupport::TestCase
def skip!(message=nil)
Rails.logger.warn "Skipping #{caller[1]}#{message}" # output caller line
end
end
Then you can simply call this and return in a one-liner:
class SomeTest < ActiveSupport::TestCase
test "do something" do
return skip!("I can't do something right now 😿")
end
end
This won't register as a skip in the count obviously, you'd have to check through minitest to see how to do that. It will just register as a passed test. However, you'll be able to detect all skips by grepping the log file.
Upvotes: 1