Sha256: f10e58d95069962c370133bb77c8b9a3fad53a7a669792383a135dd9d1020834

Contents?: true

Size: 1.2 KB

Versions: 1

Compression:

Stored size: 1.2 KB

Contents

#= require ./vendor/qunit

QUnit.config.hidepassed = true
QUnit.config.testTimeout = 5000

QUnit.begin (suiteDetails) ->
  Blade.suiteDidBegin(suiteDetails)

failedAssertions = []

QUnit.testStart (testDetails) ->
  failedAssertions = []

QUnit.log (assertionDetails) ->
  unless assertionDetails.result
    failedAssertions.push(assertionDetails)

QUnit.testDone (testDetails) ->
  name = "#{testDetails.module}: #{testDetails.name}"
  pass = testDetails.failed is 0
  message = formatAssertions(failedAssertions)
  Blade.testDidEnd({name, pass, message})

QUnit.done (suiteDetails) ->
  window.global_test_results = suiteDetails
  Blade.suiteDidEnd(suiteDetails)

formatAssertions = (assertions = []) ->
  if assertions.length
    (formatAssertion(assertion) for assertion in assertions).join("\n---\n")

formatAssertion = ({message, actual, expected, source}) ->
  lines = []
  if message
    lines.push("Message: #{JSON.stringify(message)}")
  if expected
    lines.push("Expected: #{JSON.stringify(expected)}")
  if actual
    lines.push("Actual: #{JSON.stringify(actual)}")
  if source
    lines.push("Source:")
    for sourceLine in source.split("\n").slice(0,3)
      lines.push("  #{sourceLine.trim()}")
  lines.join("\n")

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
blade-qunit_adapter-0.3.0 assets/index.coffee