diff --git a/vendor/assets/coffeescripts/headless_reporter_result.coffee b/vendor/assets/coffeescripts/headless_reporter_result.coffee index 7945ad8..e74b82f 100644 --- a/vendor/assets/coffeescripts/headless_reporter_result.coffee +++ b/vendor/assets/coffeescripts/headless_reporter_result.coffee @@ -6,20 +6,21 @@ class window.HeadlessReporterResult addResult: (message) -> @results.push(message) - print: -> - output = @name.foreground('red') + toString: -> + output = "\n" + @name.foreground('red') bestChoice = HeadlessReporterResult.findSpecLine(@splitName) output += " (#{bestChoice.file}:#{bestChoice.lineNumber})".foreground('blue') if bestChoice.file - JHW.stdout.puts "\n#{output}" for result in @results - output = result.message.foreground('red') + line = result.message.foreground('red') if result.lineNumber - output += " (line ~#{bestChoice.lineNumber + result.lineNumber})".foreground('red').bright() - JHW.stdout.puts(" " + output) + line += " (line ~#{bestChoice.lineNumber + result.lineNumber})".foreground('red').bright() + output += "\n #{line}" if result.line? - JHW.stdout.puts(" #{result.line}".foreground('yellow')) + output += "\n #{result.line}".foreground('yellow') + + output @findSpecLine: (splitName) -> bestChoice = { accuracy: 0, file: null, lineNumber: null } diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee b/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee index aee9087..01ab8c4 100644 --- a/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee +++ b/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee @@ -28,7 +28,9 @@ class jasmine.HeadlessConsoleReporter output = "TOTAL||#{@length}||#{@failedCount}||#{runtime}||#{if JHW._hasErrors then "T" else "F"}" JHW.report.puts(output) - result.print() for result in @results + + for result in @results + JHW.stdout.puts(result.toString()) if window.JHW window.onbeforeunload = null diff --git a/vendor/assets/javascripts/headless_reporter_result.js b/vendor/assets/javascripts/headless_reporter_result.js index 3d71200..7fdc972 100644 --- a/vendor/assets/javascripts/headless_reporter_result.js +++ b/vendor/assets/javascripts/headless_reporter_result.js @@ -11,30 +11,26 @@ return this.results.push(message); }; - HeadlessReporterResult.prototype.print = function() { - var bestChoice, output, result, _i, _len, _ref, _results; - output = this.name.foreground('red'); + HeadlessReporterResult.prototype.toString = function() { + var bestChoice, line, output, result, _i, _len, _ref; + output = "\n" + this.name.foreground('red'); bestChoice = HeadlessReporterResult.findSpecLine(this.splitName); if (bestChoice.file) { output += (" (" + bestChoice.file + ":" + bestChoice.lineNumber + ")").foreground('blue'); } - JHW.stdout.puts("\n" + output); _ref = this.results; - _results = []; for (_i = 0, _len = _ref.length; _i < _len; _i++) { result = _ref[_i]; - output = result.message.foreground('red'); + line = result.message.foreground('red'); if (result.lineNumber) { - output += (" (line ~" + (bestChoice.lineNumber + result.lineNumber) + ")").foreground('red').bright(); + line += (" (line ~" + (bestChoice.lineNumber + result.lineNumber) + ")").foreground('red').bright(); } - JHW.stdout.puts(" " + output); + output += "\n " + line; if (result.line != null) { - _results.push(JHW.stdout.puts((" " + result.line).foreground('yellow'))); - } else { - _results.push(void 0); + output += ("\n " + result.line).foreground('yellow'); } } - return _results; + return output; }; HeadlessReporterResult.findSpecLine = function(splitName) { diff --git a/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js b/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js index 70f0800..c276b3a 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js +++ b/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js @@ -32,7 +32,7 @@ _ref = this.results; for (_i = 0, _len = _ref.length; _i < _len; _i++) { result = _ref[_i]; - result.print(); + JHW.stdout.puts(result.toString()); } if (window.JHW) window.onbeforeunload = null; return JHW.finishSuite();