clean up the printing of headless reporter results
This commit is contained in:
parent
af14f69a07
commit
a291fd5de3
@ -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 }
|
||||
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user