Commit 7d0b40a5 7d0b40a5fb2ee2ed2ae0ec6c6d1680e57c012070 by Nicolas Perriault

fixes #260 - Don't display test error messages when not testing

1 parent c55dc1bc
......@@ -269,6 +269,7 @@ function bootstrap(global) {
phantom.exit(0);
} else if (phantom.casperArgs.get(0) === "test") {
phantom.casperScript = fs.absolute(fs.pathJoin(phantom.casperPath, 'tests', 'run.js'));
phantom.casperTest = true;
phantom.casperArgs.drop("test");
} else if (phantom.casperArgs.get(0) === "selftest") {
phantom.casperScript = fs.absolute(fs.pathJoin(phantom.casperPath, 'tests', 'run.js'));
......
......@@ -610,9 +610,19 @@ Tester.prototype.comment = function comment(message) {
this.casper.echo('# ' + message, 'COMMENT');
};
/**
* Configure casper callbacks for testing purpose.
*
*/
Tester.prototype.configure = function configure() {
"use strict";
var tester = this;
// Do not hook casper if we're not testing
if (!phantom.casperTest) {
return;
}
// specific timeout callbacks
this.casper.options.onStepTimeout = function test_onStepTimeout(timeout, step) {
tester.fail(f("Step timeout occured at step %d (%dms)", step, timeout));
......