Sha256: 162d5582b06a5c2da9717eab339d6bba0a6e4265b7722d678fe0bd5ed2a21f5f

Contents?: true

Size: 1.72 KB

Versions: 8

Compression:

Stored size: 1.72 KB

Contents

class Teabag.Reporters.Console

  constructor: ->
    @start = new Teabag.Date()
    @suites = {}


  reportRunnerStarting: (runner) ->
    @log
      type:  "runner"
      total: runner.total || runner.specs().length
      start: JSON.parse(JSON.stringify(@start))


  reportSuites: ->
    for suite, index in @spec.getParents()
      continue if @suites[suite.fullDescription]
      @suites[suite.fullDescription] = true
      @log
        type:  "suite"
        label: suite.description
        level: index


  reportSpecResults: (spec) ->
    @spec = new Teabag.Spec(spec)
    result = @spec.result()
    @reportSuites()
    switch result.status
      when "pending" then @trackPending()
      when "failed" then @trackFailure()
      else
        @log
          type:    "spec"
          suite:   @spec.suiteName
          label:   @spec.description
          status:  result.status
          skipped: result.skipped


  trackPending: ->
    result = @spec.result()
    @log
      type:    "spec"
      suite:   @spec.suiteName
      label:   @spec.description
      status:  result.status
      skipped: result.skipped


  trackFailure: ->
    result = @spec.result()
    for error in @spec.errors()
      @log
        type:    "spec"
        suite:   @spec.suiteName
        label:   @spec.description
        status:  result.status
        skipped: result.skipped
        link:    @spec.link
        message: error.message
        trace:   error.stack || error.message || "Stack Trace Unavailable"


  reportRunnerResults: =>
    @log
      type:    "result"
      elapsed: ((new Teabag.Date().getTime() - @start.getTime()) / 1000).toFixed(5)
    Teabag.finished = true


  log: (obj = {}) ->
    obj["_teabag"] = true
    Teabag.log(JSON.stringify(obj))

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
teabag-0.4.6 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.4.5 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.4.4 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.4.3 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.4.2 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.4.1 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.4.0 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.3.6 app/assets/javascripts/teabag/base/reporters/console.coffee