Sha256: 0af2b2c7d78d981a87de2dbc3718689bd1466dd47908240cd36ae158e032b6fe

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

fs = require 'fs'
print = (s) -> fs.write "/dev/stderr", s, 'w'

page = new WebPage()
page.onConsoleMessage = (msg) -> console.error msg

timeoutId = null
deferTimeout = ->
  clearTimeout timeoutId if timeoutId
  timeoutId = setTimeout ->
    console.error "Timeout"
    phantom.exit 1
  , 3000

console.log "Local time: #{new Date}"

page.open phantom.args[0], ->
  deferTimeout()

  setInterval ->
    tests = page.evaluate ->
      tests = document.getElementById('qunit-tests').children
      for test in tests when test.className isnt 'running' and not test.recorded
        test.recorded = true
        if test.className is 'pass'
          '.'
        else if test.className is 'fail'
          'F'

    for test in tests when test
      deferTimeout()
      print test

    result = page.evaluate ->
      result = document.getElementById('qunit-testresult')
      tests  = document.getElementById('qunit-tests').children

      if result.innerText.match /completed/
        console.error ""

        for test in tests when test.className is 'fail'
          console.error test.innerText

        console.error result.innerText
        return parseInt result.getElementsByClassName('failed')[0].innerText

      return

    phantom.exit result if result?
  , 100

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
local_time-1.0.2 test/javascripts/vendor/run-qunit.coffee
local_time-1.0.1 test/javascripts/vendor/run-qunit.coffee
local_time-1.0.0 test/javascripts/vendor/run-qunit.coffee