Commit 62f65d75 62f65d750140cef9c9d3923090808826e60e4c56 by Nicolas Perriault

smarter Casper.echo()

1 parent 7db58eff
1 Subproject commit de794d9573bb5b23da162129482b2d8a9acfbddc 1 Subproject commit fa26816f9ddc9f40de50c6b478b7a57265293806
......
...@@ -497,6 +497,17 @@ Casper.prototype.each = function each(array, fn) { ...@@ -497,6 +497,17 @@ Casper.prototype.each = function each(array, fn) {
497 */ 497 */
498 Casper.prototype.echo = function echo(text, style, pad) { 498 Casper.prototype.echo = function echo(text, style, pad) {
499 "use strict"; 499 "use strict";
500 if (!utils.isString(text)) {
501 try {
502 text = text.toString();
503 } catch (e) {
504 try {
505 text = utils.serialize(text);
506 } catch (e) {
507 text = '';
508 }
509 }
510 }
500 var message = style ? this.colorizer.colorize(text, style, pad) : text; 511 var message = style ? this.colorizer.colorize(text, style, pad) : text;
501 console.log(this.filter('echo.message', message) || message); 512 console.log(this.filter('echo.message', message) || message);
502 return this; 513 return this;
......