Skip to content

Commit e4e857f

Browse files
committed
Fix filter Regex (Fixes #1)
1 parent ba15b1e commit e4e857f

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Diff for: lib/guard/jasmine/phantomjs/run-jasmine.coffee

+7-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
1212
condition = (if typeof testFx is 'string' then eval testFx else testFx())
1313
else
1414
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!" }
1616
phantom.exit(1)
1717
else
1818
if typeof onReady is 'string' then eval onReady else onReady()
@@ -23,7 +23,7 @@ waitFor = (testFx, onReady, timeOutMillis=3000) ->
2323
# Check arguments of the script.
2424
#
2525
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!" }
2727
phantom.exit()
2828
else
2929
url = phantom.args[0]
@@ -33,7 +33,8 @@ page = new WebPage()
3333
# Output the Jasmine test runner result as JSON object.
3434
# Ignore all other calls to console.log
3535
#
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)
3738

3839
# Open web page and run the Jasmine test runner
3940
#
@@ -46,7 +47,9 @@ page.open url, (status) ->
4647

4748
else
4849
# 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
5053
, ->
5154
# Jasmine test runner has finished, extract the result from the DOM
5255
page.evaluate ->

0 commit comments

Comments
 (0)