Commit 02ecf7e4 02ecf7e4684cca5e86d0c1fcdd67fd26070ecacd by Nicolas Perriault

fixed `Casper.die()` were not printing the error onto the console

1 parent 04e11b5a
......@@ -4,6 +4,7 @@ CasperJS Changelog
XXXX-XX-XX, v1.0.0
------------------
- fixed `Casper.die()` and `Casper.evaluateOrDie()` were not printing the error onto the console
- fixed [#266](https://github.com/n1k0/casperjs/issues/266) - Fix `tester` module and its self tests
- fixed [#268](https://github.com/n1k0/casperjs/issues/266) - Wrong message on step timeout
- fixed [#215](https://github.com/n1k0/casperjs/issues/215) - added a `--fail-fast` option to the `casper test` command, in order to terminate a test suite execution as soon as any failure is encountered
......
......@@ -465,6 +465,7 @@ Casper.prototype.die = function die(message, status) {
message = "Suite explicitely interrupted without any message given.";
}
this.log(message, "error");
this.echo(message, "ERROR");
this.emit('die', message, status);
if (utils.isFunction(this.options.onDie)) {
this.options.onDie.call(this, this, message, status);
......@@ -568,6 +569,10 @@ Casper.prototype.echo = function echo(text, style, pad) {
Casper.prototype.evaluate = function evaluate(fn, context) {
"use strict";
this.checkStarted();
// preliminary checks
if (!utils.isFunction(fn) && !utils.isString(fn)) { // phantomjs allows functions defs as string
throw new CasperError("evaluate() only accepts functions or strings");
}
// ensure client utils are always injected
this.injectClientUtils();
// function context
......