Sha256: 89f0749cf783d93724f5cfdb9746d8e39ef6f6607ced220a00b4a1ab231c6a04
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true require 'cucumber/platform' module Cucumber module Formatter @backtrace_filters = %w[ /vendor/rails lib/cucumber bin/cucumber: lib/rspec gems/ minitest test/unit .gem/ruby lib/ruby/ bin/bundle ] @backtrace_filters << 'org/jruby/' if ::Cucumber::JRUBY BACKTRACE_FILTER_PATTERNS = Regexp.new(@backtrace_filters.join('|')) class BacktraceFilter def initialize(exception) @exception = exception end def exception return @exception if ::Cucumber.use_full_backtrace pwd_pattern = /#{::Regexp.escape(::Dir.pwd)}\//m # rubocop:disable Style/RegexpLiteral backtrace = @exception.backtrace.map { |line| line.gsub(pwd_pattern, './') } filtered = (backtrace || []).reject do |line| line =~ BACKTRACE_FILTER_PATTERNS end if ::ENV['CUCUMBER_TRUNCATE_OUTPUT'] # Strip off file locations filtered = filtered.map do |line| line =~ /(.*):in `/ ? Regexp.last_match(1) : line end end @exception.set_backtrace(filtered) @exception end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cucumber-4.0.0.rc.1 | lib/cucumber/formatter/backtrace_filter.rb |