diff --git a/spec/atom-reporter.coffee b/spec/atom-reporter.coffee index 1df74f64d..ba06cd31d 100644 --- a/spec/atom-reporter.coffee +++ b/spec/atom-reporter.coffee @@ -23,21 +23,21 @@ formatStackTrace = (spec, message='', stackTrace) -> lines.shift() if message.trim() is errorMatch?[1]?.trim() lines = lines.map (line) -> - line = line - # at jasmine.Spec. (path:1:2) -> at path:1:2 - .replace(/at jasmine\.Spec\. \(([^)]+)\)/, 'at $1') - # at it (path:1:2) -> at path:1:2 - .replace(/at f*it \(([^)]+)\)/, 'at $1') - # at spec/file-test.js -> at file-test.js - .replace("at #{spec.specDirectory}#{path.sep}", 'at ') - # (spec/file-test.js:1:2) -> (file-test.js:1:2) - .replace("(#{spec.specDirectory}#{path.sep}", '(') + line = line.trim() + if line.startsWith('at ') + line = line + # at jasmine.Spec. (path:1:2) -> at path:1:2 + .replace(/^at jasmine\.Spec\. \(([^)]+)\)/, 'at $1') + # at it (path:1:2) -> at path:1:2 + .replace(/^at f*it \(([^)]+)\)/, 'at $1') + # at spec/file-test.js -> at file-test.js + .replace(spec.specDirectory + path.sep, '') - if process.platform is 'win32' and /file:\/\/\//.test(line) - # file:///C:/some/file -> C:\some\file - line = line.replace('file:///', '').replace(///#{path.posix.sep}///g, path.win32.sep) + if process.platform is 'win32' and /file:\/\/\//.test(line) + # file:///C:/some/file -> C:\some\file + line = line.replace('file:///', '').replace(///#{path.posix.sep}///g, path.win32.sep) - return line.trim() + return line lines.join('\n').trim()