Sha256: 5f7084d48972bf3130c3bfae4de94f510cfe3b9ea71a2128fa3285bb8ec95e4e

Contents?: true

Size: 1.8 KB

Versions: 5

Compression:

Stored size: 1.8 KB

Contents

class Teabag.Reporters.Console

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


  reportRunnerStarting: (runner) ->
    @log
      type:  "runner"
      total: runner.total || runner.specs?().length || 0
      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()
    return if result.skipped
    @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.fullDescription
        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)
      coverage: window.__coverage__
    Teabag.finished = true


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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
teabag-0.7.3 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.7.2 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.7.1 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.7.0 app/assets/javascripts/teabag/base/reporters/console.coffee
teabag-0.6.0 app/assets/javascripts/teabag/base/reporters/console.coffee