 # Output the Jasmine test runner result as JSON object.
 # Ignore all other calls to console.log
 #
-page.onConsoleMessage = (msg) -> console.log(RegExp.$1) if /^JasmineResult: (.*)$/.test(msg)
+page.onConsoleMessage = (msg) ->
+  console.log(RegExp.$1) if /^JasmineResult: ([\s\S]*)$/.test(msg)
 
 # Open web page and run the Jasmine test runner
 #


  else
    # Wait until the Jasmine test is run
    waitFor -> page.evaluate -> if document.body.querySelector '.finished-at' then true else false
    , ->
        # Jasmine test runner has finished, extract the result from the DOM
        page.evaluate ->

      condition = (if typeof testFx is 'string' then eval testFx else testFx())
    else
      if not condition
        console.log JSON.stringify { error: "Timeout requesting Jasmine test runner!" }
        phantom.exit(1)
      else
        if typeof onReady is 'string' then eval onReady else onReady()
