Merge pull request #536 from clochix/patch-2
Upgrade migration to 1.1 guide with patchRequire
Showing
1 changed file
with
19 additions
and
0 deletions
... | @@ -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. | ... | ... |
-
Please register or sign in to post a comment