Skip to content

Commit 0d44226

Browse files
authored
Merge pull request #561 from fatkodima/do-not-swallow-regexp-errors
Do not swallow `config.ignore` regexp errors
2 parents e00c667 + e70fe5b commit 0d44226

File tree

2 files changed

+0
-12
lines changed

2 files changed

+0
-12
lines changed

lib/coverband/configuration.rb

-2
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,6 @@ def search_paths=(path_array)
224224
def ignore=(ignored_array)
225225
ignored_array = ignored_array.map { |ignore_str| Regexp.new(ignore_str) }
226226
@ignore |= ignored_array
227-
rescue RegexpError
228-
logger.error "an invalid regular expression was passed in, ensure string are valid regex patterns #{ignored_array.join(",")}"
229227
end
230228

231229
def current_root

test/coverband/configuration_test.rb

-10
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,6 @@ def setup
3939
assert_equal expected, Coverband.configuration.ignore
4040
end
4141

42-
test "ignore catches regex errors" do
43-
Coverband.configuration.logger.expects(:error).with("an invalid regular expression was passed in, ensure string are valid regex patterns *invalidRegex*")
44-
Coverband.configure do |config|
45-
config.ignore = ["*invalidRegex*"]
46-
end
47-
Coverband::Collectors::Coverage.instance.reset_instance
48-
expected = (Coverband::Configuration::IGNORE_DEFAULTS << "config/environments").map { |str| Regexp.new(str) }
49-
assert_equal expected, Coverband.configuration.ignore
50-
end
51-
5242
test "ignore" do
5343
Coverband::Collectors::Coverage.instance.reset_instance
5444
assert !Coverband.configuration.ignore.first.nil?

0 commit comments

Comments
 (0)