diff options
| author | Jez Ng | 2012-09-09 05:49:17 -0400 |
|---|---|---|
| committer | Jez Ng | 2012-09-09 15:02:59 -0400 |
| commit | 7c870b5faee077dd6ae73da1ee637d26ba9f09c7 (patch) | |
| tree | 3e3cf30dc95abeab8e0ff4beb5c0e9f4c2a9969f /tests | |
| parent | c72edd2193a8c95626a56195547dbfece0be2634 (diff) | |
| download | vimium-7c870b5faee077dd6ae73da1ee637d26ba9f09c7.tar.bz2 | |
Add JSCoverage support.
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 |
