diff --git a/lib/cucumber/formatter/backtrace_filter.rb b/lib/cucumber/formatter/backtrace_filter.rb index b4dafa4b2..fe338ebb3 100644 --- a/lib/cucumber/formatter/backtrace_filter.rb +++ b/lib/cucumber/formatter/backtrace_filter.rb @@ -43,8 +43,10 @@ def exception if ::ENV['CUCUMBER_TRUNCATE_OUTPUT'] # Strip off file locations + regexp = /(.*):in (?:'|`)/ filtered = filtered.map do |line| - line =~ /(.*):in ('|`)/ ? Regexp.last_match(1) : line + match = regexp.match(line) + match ? match[1] : line end end