@@ -12,7 +12,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
12
12
condition = (if typeof testFx is ' string' then eval testFx else testFx ())
13
13
else
14
14
if not condition
15
- console .log " JasmineResult: #{ JSON .stringify { error : " Timeout requesting Jasmine test runner!" } } "
15
+ console .log JSON .stringify { error : " Timeout requesting Jasmine test runner!" }
16
16
phantom .exit (1 )
17
17
else
18
18
if typeof onReady is ' string' then eval onReady else onReady ()
@@ -23,7 +23,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
23
23
# Check arguments of the script.
24
24
#
25
25
if phantom .args .length isnt 1
26
- console .log " JasmineResult: #{ JSON .stringify { error : " Wrong usage of PhantomJS script!" } } "
26
+ console .log JSON .stringify { error : " Wrong usage of PhantomJS script!" }
27
27
phantom .exit ()
28
28
else
29
29
url = phantom .args [0 ]
@@ -33,7 +33,8 @@ page = new WebPage()
33
33
# Output the Jasmine test runner result as JSON object.
34
34
# Ignore all other calls to console.log
35
35
#
36
- page .onConsoleMessage = (msg ) -> console .log (RegExp .$1 ) if / ^ JasmineResult: (. * )$ / .test (msg)
36
+ page .onConsoleMessage = (msg ) ->
37
+ console .log (RegExp .$1 ) if / ^ JasmineResult: ([\s\S ] * )$ / .test (msg)
37
38
38
39
# Open web page and run the Jasmine test runner
39
40
#
@@ -46,7 +47,9 @@ page.open url, (status) ->
46
47
47
48
else
48
49
# Wait until the Jasmine test is run
49
- waitFor -> page .evaluate -> if document .body .querySelector ' .finished-at' then true else false
50
+ waitFor ->
51
+ page .evaluate ->
52
+ if document .body .querySelector ' .finished-at' then true else false
50
53
, ->
51
54
# Jasmine test runner has finished, extract the result from the DOM
52
55
page .evaluate ->
0 commit comments