Sha256: 3d82bb7966ed749366faf475e33a670d9e06dbee7accc2aa9376d956373552fe

Contents?: true

Size: 1.25 KB

Versions: 7

Compression:

Stored size: 1.25 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

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

  setInterval ->
    tests = page.evaluate ->
      tests = document.getElementById('qunit-tests')?.children
      return unless tests
      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'

    return unless tests
    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

7 entries across 7 versions & 2 rubygems

Version Path
deckar01-task_list-2.0.1 test/run-qunit.coffee
deckar01-task_list-2.0.0 test/run-qunit.coffee
deckar01-task_list-1.0.6 test/run-qunit.coffee
deckar01-task_list-1.0.5 test/run-qunit.coffee
deckar01-task_list-1.0.4 test/run-qunit.coffee
deckar01-task_list-1.0.3 test/run-qunit.coffee
task_list-1.0.2 test/run-qunit.coffee