fixed `Casper.die()` were not printing the error onto the console
Showing
2 changed files
with
6 additions
and
0 deletions
... | @@ -4,6 +4,7 @@ CasperJS Changelog | ... | @@ -4,6 +4,7 @@ CasperJS Changelog |
4 | XXXX-XX-XX, v1.0.0 | 4 | XXXX-XX-XX, v1.0.0 |
5 | ------------------ | 5 | ------------------ |
6 | 6 | ||
7 | - fixed `Casper.die()` and `Casper.evaluateOrDie()` were not printing the error onto the console | ||
7 | - fixed [#266](https://github.com/n1k0/casperjs/issues/266) - Fix `tester` module and its self tests | 8 | - fixed [#266](https://github.com/n1k0/casperjs/issues/266) - Fix `tester` module and its self tests |
8 | - fixed [#268](https://github.com/n1k0/casperjs/issues/266) - Wrong message on step timeout | 9 | - fixed [#268](https://github.com/n1k0/casperjs/issues/266) - Wrong message on step timeout |
9 | - 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 | 10 | - 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) { | ... | @@ -465,6 +465,7 @@ Casper.prototype.die = function die(message, status) { |
465 | message = "Suite explicitely interrupted without any message given."; | 465 | message = "Suite explicitely interrupted without any message given."; |
466 | } | 466 | } |
467 | this.log(message, "error"); | 467 | this.log(message, "error"); |
468 | this.echo(message, "ERROR"); | ||
468 | this.emit('die', message, status); | 469 | this.emit('die', message, status); |
469 | if (utils.isFunction(this.options.onDie)) { | 470 | if (utils.isFunction(this.options.onDie)) { |
470 | this.options.onDie.call(this, this, message, status); | 471 | this.options.onDie.call(this, this, message, status); |
... | @@ -568,6 +569,10 @@ Casper.prototype.echo = function echo(text, style, pad) { | ... | @@ -568,6 +569,10 @@ Casper.prototype.echo = function echo(text, style, pad) { |
568 | Casper.prototype.evaluate = function evaluate(fn, context) { | 569 | Casper.prototype.evaluate = function evaluate(fn, context) { |
569 | "use strict"; | 570 | "use strict"; |
570 | this.checkStarted(); | 571 | this.checkStarted(); |
572 | // preliminary checks | ||
573 | if (!utils.isFunction(fn) && !utils.isString(fn)) { // phantomjs allows functions defs as string | ||
574 | throw new CasperError("evaluate() only accepts functions or strings"); | ||
575 | } | ||
571 | // ensure client utils are always injected | 576 | // ensure client utils are always injected |
572 | this.injectClientUtils(); | 577 | this.injectClientUtils(); |
573 | // function context | 578 | // function context | ... | ... |
-
Please register or sign in to post a comment