update reporter

This commit is contained in:
John Bintz 2012-01-11 11:37:25 -05:00
parent 282ed40264
commit b9b4648a24
2 changed files with 50 additions and 7 deletions

View File

@ -16,11 +16,30 @@ class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleB
indentSpec: (current, last, color) => indentSpec: (current, last, color) =>
last = last.slice(0) last = last.slice(0)
lines = []
for name in current
if last.shift() != name
lines.push(name)
else
lines.push(null)
this.indentLines(lines, color)
indentLines: (lines, color) =>
indent = ''
output = [] output = []
indent = '' for line in lines
for name in current if line?
output.push(indent + name.foreground(color)) if last.shift() != name outputLine = indent
outputLine += this.colorLine(line, color)
output.push(outputLine)
indent += ' ' indent += ' '
output output
colorLine: (line, color) =>
line.foreground(color)

View File

@ -6,6 +6,8 @@
__extends(Verbose, jasmine.HeadlessReporter.ConsoleBase); __extends(Verbose, jasmine.HeadlessReporter.ConsoleBase);
function Verbose() { function Verbose() {
this.colorLine = __bind(this.colorLine, this);
this.indentLines = __bind(this.indentLines, this);
this.indentSpec = __bind(this.indentSpec, this); this.indentSpec = __bind(this.indentSpec, this);
this.displaySpec = __bind(this.displaySpec, this); this.displaySpec = __bind(this.displaySpec, this);
this.displayFailure = __bind(this.displayFailure, this); this.displayFailure = __bind(this.displayFailure, this);
@ -29,18 +31,40 @@
}; };
Verbose.prototype.indentSpec = function(current, last, color) { Verbose.prototype.indentSpec = function(current, last, color) {
var indent, name, output, _i, _len; var lines, name, _i, _len;
last = last.slice(0); last = last.slice(0);
output = []; lines = [];
indent = '';
for (_i = 0, _len = current.length; _i < _len; _i++) { for (_i = 0, _len = current.length; _i < _len; _i++) {
name = current[_i]; name = current[_i];
if (last.shift() !== name) output.push(indent + name.foreground(color)); if (last.shift() !== name) {
lines.push(name);
} else {
lines.push(null);
}
}
return this.indentLines(lines, color);
};
Verbose.prototype.indentLines = function(lines, color) {
var indent, line, output, outputLine, _i, _len;
indent = '';
output = [];
for (_i = 0, _len = lines.length; _i < _len; _i++) {
line = lines[_i];
if (line != null) {
outputLine = indent;
outputLine += this.colorLine(line, color);
output.push(outputLine);
}
indent += ' '; indent += ' ';
} }
return output; return output;
}; };
Verbose.prototype.colorLine = function(line, color) {
return line.foreground(color);
};
return Verbose; return Verbose;
})(); })();