This commit is contained in:
Benoit Daloze 2020-08-28 20:26:00 +02:00
Родитель 1c138327e0
Коммит 3dd63108b0
6 изменённых файлов: 14 добавлений и 9 удалений

Просмотреть файл

@ -40,6 +40,15 @@ class ExceptionState
@backtrace_filter ||= MSpecScript.config[:backtrace_filter] || %r{(?:/bin/mspec|/lib/mspec/)}
bt = @exception.backtrace || []
bt.select { |line| $MSPEC_DEBUG or @backtrace_filter !~ line }.join("\n")
unless $MSPEC_DEBUG
# Exclude <internal: entries inside MSpec code, so only after the first ignored entry
first_excluded_line = bt.index { |line| @backtrace_filter =~ line }
if first_excluded_line
bt = bt[0...first_excluded_line] + bt[first_excluded_line..-1].reject { |line|
@backtrace_filter =~ line || /^<internal:/ =~ line
}
end
end
bt.join("\n")
end
end

Просмотреть файл

@ -155,7 +155,9 @@ module MSpec
# Stores the shared ContextState keyed by description.
def self.register_shared(state)
@shared[state.to_s] = state
name = state.to_s
raise "duplicated shared #describe: #{name}" if @shared.key?(name)
@shared[name] = state
end
# Returns the shared ContextState matching description.

Просмотреть файл

@ -42,7 +42,7 @@ class SpecVersion
def <=>(other)
if other.respond_to? :to_int
other = Integer other
other = Integer(other.to_int)
else
other = SpecVersion.new(String(other)).to_i
end

2
spec/mspec/spec/fixtures/config.mspec поставляемый
Просмотреть файл

@ -1,8 +1,6 @@
class MSpecScript
set :target, 'ruby'
set :backtrace_filter, /lib\/mspec\//
set :tags_patterns, [
[%r(spec/fixtures/), 'spec/fixtures/tags/'],
[/_spec.rb$/, '_tags.txt']

Просмотреть файл

@ -9,14 +9,12 @@ Expected 1 == 2
to be truthy but was false
CWD/spec/fixtures/a_spec.rb:8:in `block (2 levels) in <top (required)>'
CWD/spec/fixtures/a_spec.rb:2:in `<top (required)>'
CWD/bin/mspec-run:7:in `<main>'
2)
Foo#bar fails ERROR
RuntimeError: failure
CWD/spec/fixtures/a_spec.rb:12:in `block (2 levels) in <top (required)>'
CWD/spec/fixtures/a_spec.rb:2:in `<top (required)>'
CWD/bin/mspec-run:7:in `<main>'
Finished in D.DDDDDD seconds
EOS

Просмотреть файл

@ -28,7 +28,6 @@ Expected 1 == 2
to be truthy but was false
CWD/spec/fixtures/tagging_spec.rb:9:in `block (2 levels) in <top (required)>'
CWD/spec/fixtures/tagging_spec.rb:3:in `<top (required)>'
CWD/bin/mspec-tag:7:in `<main>'
2)
Tag#me érròrs in unicode FAILED
@ -36,7 +35,6 @@ Expected 1 == 2
to be truthy but was false
CWD/spec/fixtures/tagging_spec.rb:13:in `block (2 levels) in <top (required)>'
CWD/spec/fixtures/tagging_spec.rb:3:in `<top (required)>'
CWD/bin/mspec-tag:7:in `<main>'
Finished in D.DDDDDD seconds