Sha256: 4ce5f00c9531b7f39451a73c36683837fcf2594f9917cba15a54759b62a18309

Contents?: true

Size: 1.61 KB

Versions: 3

Compression:

Stored size: 1.61 KB

Contents

class Teabag.Reporters.Console

  constructor: ->
    @start = new Teabag.Date().getTime()


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


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


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


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


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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
teabag-0.3.5 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.3.4 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.3.3 app/assets/javascripts/teabag/base/reporters/console.coffee