mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user