Skip to content

Commit

Permalink
Do not swallow config.ignore regexp errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fatkodima committed Oct 18, 2024
1 parent b9d98e7 commit e70fe5b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
2 changes: 0 additions & 2 deletions lib/coverband/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ def search_paths=(path_array)
def ignore=(ignored_array)
ignored_array = ignored_array.map { |ignore_str| Regexp.new(ignore_str) }
@ignore |= ignored_array
rescue RegexpError
logger.error "an invalid regular expression was passed in, ensure string are valid regex patterns #{ignored_array.join(",")}"
end

def current_root
Expand Down
10 changes: 0 additions & 10 deletions test/coverband/configuration_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ def setup
assert_equal expected, Coverband.configuration.ignore
end

test "ignore catches regex errors" do
Coverband.configuration.logger.expects(:error).with("an invalid regular expression was passed in, ensure string are valid regex patterns *invalidRegex*")
Coverband.configure do |config|
config.ignore = ["*invalidRegex*"]
end
Coverband::Collectors::Coverage.instance.reset_instance
expected = (Coverband::Configuration::IGNORE_DEFAULTS << "config/environments").map { |str| Regexp.new(str) }
assert_equal expected, Coverband.configuration.ignore
end

test "ignore" do
Coverband::Collectors::Coverage.instance.reset_instance
assert !Coverband.configuration.ignore.first.nil?
Expand Down

0 comments on commit e70fe5b

Please sign in to comment.