diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/dom_tests/phantom_runner.coffee | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/tests/dom_tests/phantom_runner.coffee b/tests/dom_tests/phantom_runner.coffee index 9036b8f3..91eeb526 100644 --- a/tests/dom_tests/phantom_runner.coffee +++ b/tests/dom_tests/phantom_runner.coffee @@ -1,3 +1,5 @@ +system = require 'system' +fs = require 'fs' page = require('webpage').create() page.settings.userAgent = 'phantom' @@ -10,12 +12,10 @@ page.viewportSize = page.onConsoleMessage = (msg) -> console.log msg -system = require 'system' -fs = require 'fs' - -pathParts = system.args[0].split(fs.separator) -pathParts[pathParts.length - 1] = '' -dirname = pathParts.join(fs.separator) +dirname = do -> + pathParts = system.args[0].split(fs.separator) + pathParts[pathParts.length - 1] = '' + pathParts.join(fs.separator) page.open dirname + 'dom_tests.html', (status) -> if status != 'success' @@ -26,6 +26,10 @@ page.open dirname + 'dom_tests.html', (status) -> Tests.run() return Tests.testsFailed + if system.args[1] == '--coverage' + data = page.evaluate -> JSON.stringify _$jscoverage + fs.write dirname + 'dom_tests_coverage.json', data, 'w' + if testsFailed > 0 phantom.exit 1 else |
