Blob Blame History Raw
From 68fae17f1439a3ad29453cf10951bd3b5131fd6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?V=C3=ADt=20Ondruch?= <vondruch@redhat.com>
Date: Wed, 27 Feb 2019 15:40:37 +0100
Subject: [PATCH] Respect Ruby configuration when filtering backtrace.

The Ruby might be configured to be installed into various locations. Be
smarter about filtering backtrace to properly remove all traces of
standard library.

Fixes #1341.
---
 lib/cucumber/formatter/backtrace_filter.rb       | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/cucumber/formatter/backtrace_filter.rb b/lib/cucumber/formatter/backtrace_filter.rb
index d0359e34..d58df52a 100644
--- a/lib/cucumber/formatter/backtrace_filter.rb
+++ b/lib/cucumber/formatter/backtrace_filter.rb
@@ -13,15 +13,17 @@ module Cucumber
       minitest
       test/unit
       .gem/ruby
-      lib/ruby/
       bin/bundle
     )
+
+    @backtrace_filters << RbConfig::CONFIG['rubyarchdir']
+    @backtrace_filters << RbConfig::CONFIG['rubylibdir']
 
     if ::Cucumber::JRUBY
       @backtrace_filters << 'org/jruby/'
     end
 
-    BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.join('|'))
+    BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.compact.join('|'))
 
     class BacktraceFilter
       def initialize(exception)
-- 
2.20.1