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) ->
|
addResult: (message) ->
|
||||||
@results.push(message)
|
@results.push(message)
|
||||||
|
|
||||||
print: ->
|
toString: ->
|
||||||
output = @name.foreground('red')
|
output = "\n" + @name.foreground('red')
|
||||||
bestChoice = HeadlessReporterResult.findSpecLine(@splitName)
|
bestChoice = HeadlessReporterResult.findSpecLine(@splitName)
|
||||||
output += " (#{bestChoice.file}:#{bestChoice.lineNumber})".foreground('blue') if bestChoice.file
|
output += " (#{bestChoice.file}:#{bestChoice.lineNumber})".foreground('blue') if bestChoice.file
|
||||||
|
|
||||||
JHW.stdout.puts "\n#{output}"
|
|
||||||
for result in @results
|
for result in @results
|
||||||
output = result.message.foreground('red')
|
line = result.message.foreground('red')
|
||||||
if result.lineNumber
|
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?
|
if result.line?
|
||||||
JHW.stdout.puts(" #{result.line}".foreground('yellow'))
|
output += "\n #{result.line}".foreground('yellow')
|
||||||
|
|
||||||
|
output
|
||||||
|
|
||||||
@findSpecLine: (splitName) ->
|
@findSpecLine: (splitName) ->
|
||||||
bestChoice = { accuracy: 0, file: null, lineNumber: null }
|
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"}"
|
output = "TOTAL||#{@length}||#{@failedCount}||#{runtime}||#{if JHW._hasErrors then "T" else "F"}"
|
||||||
|
|
||||||
JHW.report.puts(output)
|
JHW.report.puts(output)
|
||||||
result.print() for result in @results
|
|
||||||
|
for result in @results
|
||||||
|
JHW.stdout.puts(result.toString())
|
||||||
|
|
||||||
if window.JHW
|
if window.JHW
|
||||||
window.onbeforeunload = null
|
window.onbeforeunload = null
|
||||||
|
@ -11,30 +11,26 @@
|
|||||||
return this.results.push(message);
|
return this.results.push(message);
|
||||||
};
|
};
|
||||||
|
|
||||||
HeadlessReporterResult.prototype.print = function() {
|
HeadlessReporterResult.prototype.toString = function() {
|
||||||
var bestChoice, output, result, _i, _len, _ref, _results;
|
var bestChoice, line, output, result, _i, _len, _ref;
|
||||||
output = this.name.foreground('red');
|
output = "\n" + this.name.foreground('red');
|
||||||
bestChoice = HeadlessReporterResult.findSpecLine(this.splitName);
|
bestChoice = HeadlessReporterResult.findSpecLine(this.splitName);
|
||||||
if (bestChoice.file) {
|
if (bestChoice.file) {
|
||||||
output += (" (" + bestChoice.file + ":" + bestChoice.lineNumber + ")").foreground('blue');
|
output += (" (" + bestChoice.file + ":" + bestChoice.lineNumber + ")").foreground('blue');
|
||||||
}
|
}
|
||||||
JHW.stdout.puts("\n" + output);
|
|
||||||
_ref = this.results;
|
_ref = this.results;
|
||||||
_results = [];
|
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
result = _ref[_i];
|
result = _ref[_i];
|
||||||
output = result.message.foreground('red');
|
line = result.message.foreground('red');
|
||||||
if (result.lineNumber) {
|
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) {
|
if (result.line != null) {
|
||||||
_results.push(JHW.stdout.puts((" " + result.line).foreground('yellow')));
|
output += ("\n " + result.line).foreground('yellow');
|
||||||
} else {
|
|
||||||
_results.push(void 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return _results;
|
return output;
|
||||||
};
|
};
|
||||||
|
|
||||||
HeadlessReporterResult.findSpecLine = function(splitName) {
|
HeadlessReporterResult.findSpecLine = function(splitName) {
|
||||||
|
@ -32,7 +32,7 @@
|
|||||||
_ref = this.results;
|
_ref = this.results;
|
||||||
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
|
||||||
result = _ref[_i];
|
result = _ref[_i];
|
||||||
result.print();
|
JHW.stdout.puts(result.toString());
|
||||||
}
|
}
|
||||||
if (window.JHW) window.onbeforeunload = null;
|
if (window.JHW) window.onbeforeunload = null;
|
||||||
return JHW.finishSuite();
|
return JHW.finishSuite();
|
||||||
|
Loading…
Reference in New Issue
Block a user