Commit a447e1f7 a447e1f7d70b42d6518375f5bd25bd70485c0368 by Clochix

Upgrade migration to 1.1 guide with patchRequire

When upgrading to Casper 1.1, custom modules have to call the new patchRequire global function.
1 parent ded41ef4
...@@ -65,3 +65,22 @@ More asynchronously:: ...@@ -65,3 +65,22 @@ More asynchronously::
65 .. note:: 65 .. note::
66 66
67 Please note that ``begin()``'s the second argument which is now the place to set the number of planned tests. 67 Please note that ``begin()``'s the second argument which is now the place to set the number of planned tests.
68
69
70 require() in custom modules
71 ---------------------------
72
73 CasperJS 1.1 now internally uses PhantomJS' native ``require()`` function, but it has side effect if you write your own casperjs modules; in any casperjs module, you now have to use the new global ``patchRequire()`` function first::
74
75 // casperjs module code
76 var require = patchRequire(require);
77 // now you can require casperjs builtins
78 var utils = require('utils');
79 exports = {
80 // ...
81 };
82
83
84 .. note::
85
86 You don't have to use ``patchRequire()`` in a standard casperjs script.
......