Skip to content
This repository was archived by the owner on Nov 30, 2024. It is now read-only.

More filtering of JRuby #417

Merged
merged 4 commits into from
Jun 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions lib/rspec/support/spec/shell_out.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,30 @@ def run_ruby_with_current_load_path(ruby_command, *flags)
end
end

def strip_known_warnings(input)
input.split("\n").reject do |l|
LINES_TO_IGNORE =
[
# Ignore bundler warning.
l =~ %r{bundler/source/rubygems} ||
%r{bundler/source/rubygems},
# Ignore bundler + rubygems warning.
l =~ %r{site_ruby/\d\.\d\.\d/rubygems} ||
l =~ %r{jruby-\d\.\d\.\d\.\d/lib/ruby/stdlib/rubygems} ||
%r{site_ruby/\d\.\d\.\d/rubygems},
%r{jruby-\d\.\d\.\d\.\d/lib/ruby/stdlib/rubygems},
# This is required for windows for some reason
l =~ %r{lib/bundler/rubygems} ||
%r{lib/bundler/rubygems},
# This is a JRuby file that generates warnings on 9.0.3.0
l =~ %r{lib/ruby/stdlib/jar} ||
%r{lib/ruby/stdlib/jar},
# This is a JRuby file that generates warnings on 9.1.7.0
l =~ %r{org/jruby/RubyKernel\.java} ||
%r{org/jruby/RubyKernel\.java},
# This is a JRuby gem that generates warnings on 9.1.7.0
l =~ %r{uninitialized constant FFI} ||
l =~ %r{io/console on JRuby shells out to stty for most operations} ||
%r{ffi-1\.13\.\d+-java},
%r{uninitialized constant FFI},
# These are related to the above, there is a warning about io from FFI
%r{jruby-\d\.\d\.\d\.\d/lib/ruby/stdlib/io},
%r{io/console on JRuby shells out to stty for most operations},
]

def strip_known_warnings(input)
input.split("\n").reject do |l|
LINES_TO_IGNORE.any? { |to_ignore| l =~ to_ignore } ||
# Remove blank lines
l == "" || l.nil?
end.join("\n")
Expand Down