2012-01-10 22:14:37 +00:00
|
|
|
#= require jasmine.HeadlessReporter.ConsoleBase
|
|
|
|
#
|
|
|
|
class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase
|
|
|
|
displaySuccess: (spec) =>
|
|
|
|
this.displaySpec(spec, 'green')
|
|
|
|
|
|
|
|
displayFailure: (spec) =>
|
|
|
|
this.displaySpec(spec, 'red')
|
|
|
|
|
|
|
|
displaySpec: (spec, color) =>
|
|
|
|
currentLastNames = (@lastNames || []).slice(0)
|
|
|
|
@lastNames = spec.getSpecSplitName()
|
|
|
|
|
2012-01-11 19:24:09 +00:00
|
|
|
for line in this.indentSpec(@lastNames, currentLastNames, color)
|
|
|
|
if line? and !_.isEmpty(line)
|
|
|
|
this.puts(line)
|
2012-01-10 22:14:37 +00:00
|
|
|
|
|
|
|
indentSpec: (current, last, color) =>
|
|
|
|
last = last.slice(0)
|
|
|
|
|
2012-01-11 16:37:25 +00:00
|
|
|
lines = []
|
2012-01-10 22:14:37 +00:00
|
|
|
|
|
|
|
for name in current
|
2012-01-11 16:37:25 +00:00
|
|
|
if last.shift() != name
|
|
|
|
lines.push(name)
|
|
|
|
else
|
|
|
|
lines.push(null)
|
|
|
|
|
|
|
|
this.indentLines(lines, color)
|
|
|
|
|
|
|
|
indentLines: (lines, color) =>
|
|
|
|
indent = ''
|
|
|
|
|
|
|
|
output = []
|
|
|
|
|
|
|
|
for line in lines
|
|
|
|
if line?
|
|
|
|
outputLine = indent
|
|
|
|
outputLine += this.colorLine(line, color)
|
|
|
|
|
|
|
|
output.push(outputLine)
|
2012-01-10 22:14:37 +00:00
|
|
|
indent += ' '
|
|
|
|
|
|
|
|
output
|
2012-01-11 16:37:25 +00:00
|
|
|
|
|
|
|
colorLine: (line, color) =>
|
|
|
|
line.foreground(color)
|