From d5bda44b3b9d3fd32cf362033518b0ea45e97749 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoshiki=20V=C3=A1zquez=20Baeza?= Date: Thu, 7 Jul 2016 12:04:18 -0700 Subject: [PATCH] TST/BUG: Remove error messages from tests --- tests/javascript_tests/runner.js | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/javascript_tests/runner.js b/tests/javascript_tests/runner.js index 403d560d..2b49c019 100644 --- a/tests/javascript_tests/runner.js +++ b/tests/javascript_tests/runner.js @@ -51,7 +51,7 @@ result = message.data; failed = !result || result.failed; - phantom.exit(failed ? 1 : 0); + exit(failed ? 1 : 0); } } }; @@ -59,7 +59,7 @@ page.open(url, function(status) { if (status !== 'success') { console.error('Unable to access network: ' + status); - phantom.exit(1); + exit(1); } else { // Cannot do this verification with the 'DOMContentLoaded' handler because it // will be too late to attach it if a page does not have any script tags. @@ -136,4 +136,21 @@ }); }, false); } + + /* + This function was taken from: + https://github.com/jonkemp/qunit-phantomjs-runner + + It helps prevent some problems with the output produced by this script. + */ + function exit(code) { + if (page) { + page.close(); + } + setTimeout(function () { + phantom.exit(code); + }, 0); + } + + })();