From adebae6c470d4344d28e3741ad29cda8898e319b Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Sat, 6 Jul 2013 14:03:13 -0700 Subject: [PATCH] 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. --- spec/atom-reporter.coffee | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 5636647ca..90e15106e 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -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)