2011-05-12 21:02:11 +00:00
|
|
|
if !jasmine?
|
|
|
|
throw new Exception("jasmine not laoded!")
|
|
|
|
|
|
|
|
class HeadlessReporterResult
|
|
|
|
constructor: (name) ->
|
|
|
|
@name = name
|
|
|
|
@results = []
|
2011-05-12 22:47:56 +00:00
|
|
|
addResult: (message) ->
|
|
|
|
@results.push(message)
|
2011-05-12 21:02:11 +00:00
|
|
|
print: ->
|
|
|
|
JHW.printName(@name)
|
|
|
|
for result in @results
|
|
|
|
do (result) =>
|
|
|
|
JHW.printResult(result)
|
|
|
|
|
|
|
|
class jasmine.HeadlessReporter
|
|
|
|
constructor: ->
|
|
|
|
@results = []
|
|
|
|
@failedCount = 0
|
|
|
|
@length = 0
|
|
|
|
reportRunnerResults: (runner) ->
|
|
|
|
for result in @results
|
|
|
|
do (result) =>
|
|
|
|
result.print()
|
|
|
|
|
2011-05-12 22:47:56 +00:00
|
|
|
JHW.finishSuite((new Date() - @startTime) / 1000.0, @length, @failedCount)
|
2011-05-12 21:02:11 +00:00
|
|
|
reportRunnerStarting: (runner) ->
|
2011-05-12 22:47:56 +00:00
|
|
|
@startTime = new Date()
|
2011-05-12 21:02:11 +00:00
|
|
|
reportSpecResults: (spec) ->
|
|
|
|
if spec.results().passed()
|
|
|
|
JHW.specPassed()
|
|
|
|
else
|
|
|
|
JHW.specFailed()
|
|
|
|
failureResult = new HeadlessReporterResult(spec.getFullName())
|
|
|
|
for result in spec.results().getItems()
|
|
|
|
do (result) =>
|
|
|
|
if result.type == 'expect' and !result.passed_
|
|
|
|
@failedCount += 1
|
2011-05-12 22:47:56 +00:00
|
|
|
failureResult.addResult(result.message)
|
2011-05-12 21:02:11 +00:00
|
|
|
@results.push(failureResult)
|
|
|
|
reportSpecStarting: (spec) ->
|
|
|
|
reportSuiteResults: (suite) ->
|
|
|
|
@length += suite.specs().length
|