Commit 69464641 69464641f1e76f5ebd3440584c5e2f7e0a2b8f54 by Nicolas Perriault

added hint printing when a possible `casperjs` command call is detected

1 parent d9b240c8
...@@ -15,6 +15,7 @@ XXXX-XX-XX, v1.0.0 ...@@ -15,6 +15,7 @@ XXXX-XX-XX, v1.0.0
15 - merged PR [#319](https://github.com/n1k0/casperjs/pull/319), fixed [#209](https://github.com/n1k0/casperjs/issues/209) - test duration has been added to XUnit XML result file. 15 - merged PR [#319](https://github.com/n1k0/casperjs/pull/319), fixed [#209](https://github.com/n1k0/casperjs/issues/209) - test duration has been added to XUnit XML result file.
16 - `Casper.userAgent()` does not require the instance to be started anymore 16 - `Casper.userAgent()` does not require the instance to be started anymore
17 - dubious tests now have dedicated color & styling 17 - dubious tests now have dedicated color & styling
18 - added hint printing when a possible `casperjs` command call is detected
18 19
19 2012-12-14, v1.0.0-RC6 20 2012-12-14, v1.0.0-RC6
20 ---------------------- 21 ----------------------
......
...@@ -164,10 +164,21 @@ function patchRequire(require, requireDirs) { ...@@ -164,10 +164,21 @@ function patchRequire(require, requireDirs) {
164 164
165 function bootstrap(global) { 165 function bootstrap(global) {
166 "use strict"; 166 "use strict";
167
168 var phantomArgs = require('system').args; 167 var phantomArgs = require('system').args;
169 168
170 /** 169 /**
170 * Hooks in default phantomjs error handler to print a hint when a possible
171 * casperjs command misuse is detected.
172 *
173 */
174 phantom.onError = function onPhantomError(msg, trace) {
175 phantom.defaultErrorHandler.apply(phantom, arguments);
176 if (msg.indexOf("ReferenceError: Can't find variable: casper") === 0) {
177 console.error('Hint: you may want to use the `casperjs test` command.');
178 }
179 };
180
181 /**
171 * Loads and initialize the CasperJS environment. 182 * Loads and initialize the CasperJS environment.
172 */ 183 */
173 phantom.loadCasper = function loadCasper() { 184 phantom.loadCasper = function loadCasper() {
......