 # 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
 #

# Check arguments of the script.
#
if phantom.args.length isnt 1
  console.log "JasmineResult: #{ JSON.stringify { error: "Wrong usage of PhantomJS script!" } }"
  phantom.exit()
else
  url = phantom.args[0]

      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()
