-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from Shopify/rwstauner/stacktraces
Strip extra TruffleRuby stacktrace lines from test output
- Loading branch information
Showing
3 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# frozen_string_literal: true | ||
|
||
class BacktraceFilters | ||
PATTERNS = [ | ||
# truffleruby has some extra lines before the usual ruby ones: | ||
# "<internal:core> core/numeric.rb:182:in `math_coerce'" | ||
%r{^<internal:}, | ||
] | ||
|
||
def initialize(original_filter) | ||
@original_filter = original_filter | ||
end | ||
|
||
def add_filter(*args) | ||
@original_filter.add_filter(*args) | ||
end | ||
|
||
def filter(backtrace) | ||
backtrace = @original_filter.filter(backtrace) if @original_filter | ||
|
||
backtrace.reject do |line| | ||
PATTERNS.any? { |pattern| line.match?(pattern) } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters