jasmine-headless-webkit/vendor/assets/coffeescripts/jasmine.HeadlessReporter.coffee

59 lines
1.1 KiB
CoffeeScript
Raw Normal View History

2011-12-12 17:22:32 +00:00
if !jasmine?
throw new Error("jasmine not loaded!")
class jasmine.HeadlessReporter
2011-12-29 23:37:23 +00:00
constructor: (@outputTarget = null) ->
2011-12-12 17:22:32 +00:00
@results = []
@failedCount = 0
@length = 0
@timer = null
hasError: ->
JHW._hasErrors
reportSpecStarting: (spec) ->
if this.hasError()
spec.finish()
spec.suite.finish()
reportSuiteResults: (suite) ->
reportRunnerStarting: (runner) ->
@startTime = new Date()
reportRunnerResults: (runner) ->
return if this.hasError()
if @failedCount != 0
JHW.hasSpecFailure()
JHW.finishSuite()
2011-12-29 23:37:23 +00:00
if window.JHW
window.onbeforeunload = null
2011-12-12 17:22:32 +00:00
reportSpecResults: (spec) ->
return if this.hasError()
JHW.ping()
_reportSpecResult: (spec, options) ->
results = spec.results()
@length++
if results.passed()
options.success(results, spec)
else
@failedCount++
options.failure(results, spec)
_runtime: ->
(new Date() - @startTime) / 1000.0
2011-12-29 23:37:23 +00:00
print: (output) =>
JHW.print(@outputTarget, output)
puts: (output) =>
JHW.print(@outputTarget, output + "\n")