Filter ruby lib directory from error backtrace
This commit is contained in:
parent
0da47a0acb
commit
b93e5717ce
@ -25,3 +25,8 @@ Feature: CLI error reporting
|
|||||||
Given a recipe using a remote
|
Given a recipe using a remote
|
||||||
When I execute the recipe on unknown remote target
|
When I execute the recipe on unknown remote target
|
||||||
Then the output must not contain "net-ssh"
|
Then the output must not contain "net-ssh"
|
||||||
|
|
||||||
|
Scenario: excludes ruby standard library from backtrace
|
||||||
|
Given a recipe using a remote
|
||||||
|
When I execute the recipe on unknown remote target
|
||||||
|
Then the output must not contain ruby lib directory
|
||||||
|
@ -25,3 +25,7 @@ end
|
|||||||
Then /^the error output must contain exactly "([^"]+)"$/ do |content|
|
Then /^the error output must contain exactly "([^"]+)"$/ do |content|
|
||||||
assert_exact_output content, all_stderr
|
assert_exact_output content, all_stderr
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then /^the output must not contain ruby lib directory$/ do
|
||||||
|
assert_no_partial_output RbConfig::CONFIG['rubylibdir'], all_output
|
||||||
|
end
|
||||||
|
@ -3,6 +3,7 @@ module Producer
|
|||||||
class ErrorFormatter
|
class ErrorFormatter
|
||||||
FILTERS = [
|
FILTERS = [
|
||||||
/\/producer-\w+/,
|
/\/producer-\w+/,
|
||||||
|
Regexp.new(RbConfig::CONFIG['rubylibdir']),
|
||||||
/\/net-ssh/,
|
/\/net-ssh/,
|
||||||
/\/net-sftp/
|
/\/net-sftp/
|
||||||
].freeze
|
].freeze
|
||||||
|
@ -23,7 +23,8 @@ module Producer
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe '#format' do
|
describe '#format' do
|
||||||
let(:bt) { %W[backtrace /producer-core /net-ssh] }
|
let(:rubylibdir) { RbConfig::CONFIG['rubylibdir'] }
|
||||||
|
let(:bt) { %W[backtrace /producer-core /net-ssh #{rubylibdir}] }
|
||||||
|
|
||||||
def exception
|
def exception
|
||||||
begin fail 'original exception' rescue fail 'some exception' end
|
begin fail 'original exception' rescue fail 'some exception' end
|
||||||
@ -49,6 +50,10 @@ module Producer
|
|||||||
expect(formatter.format exception).not_to include 'net-ssh'
|
expect(formatter.format exception).not_to include 'net-ssh'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'excludes ruby lib directory from the backtrace' do
|
||||||
|
expect(formatter.format exception).not_to include rubylibdir
|
||||||
|
end
|
||||||
|
|
||||||
context 'when debug is enabled' do
|
context 'when debug is enabled' do
|
||||||
let(:debug) { true }
|
let(:debug) { true }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user