Remove jasmine.js lines from displayed stack trace

This removes the noise from the setup and compare lines that occur in
jasmine.js and only displays the lines that are generated from within
the failing spec.
This commit is contained in:
Kevin Sawicki
2013-07-06 14:03:13 -07:00
parent 4ae0d8af9f
commit adebae6c47

View File

@@ -166,13 +166,26 @@ class SpecResultView extends View
@description.html @spec.description
for result in @spec.results().getItems() when not result.passed()
stackTrace = @formatStackTrace(result.trace.stack)
@specFailures.append $$ ->
@div result.message, class: 'resultMessage fail'
@div result.trace.stack, class: 'stackTrace' if result.trace.stack
@div stackTrace, class: 'stackTrace' if stackTrace
attach: ->
@parentSuiteView().append this
formatStackTrace: (stackTrace) ->
return stackTrace unless stackTrace
jasminePath = require.resolve('jasmine')
jasminePattern = new RegExp("\\(#{_.escapeRegExp(jasminePath)}:\\d+:\\d+\\)\\s*$")
convertedLines = []
for line in stackTrace.split('\n')
unless jasminePattern.test(line)
convertedLines.push(line)
convertedLines.join('\n')
parentSuiteView: ->
if not suiteView = $(".suite-view-#{@spec.suite.id}").view()
suiteView = new SuiteResultView(@spec.suite)