2

I tried to figure out a memory leak issue in Phantom.js / Casper.js script and found this link

Detect node.js/javascript memory leak in code

The idea is to include heapdump module

https://github.com/bnoordhuis/node-heapdump

But when I run casperjs myapp.js and it gave error that it cannot find this heapdump lib even though I installed it.

var heapdump = require('heapdump');

Is casperjs different from nodejs?

Community
  • 1
  • 1
HP.
  • 19,226
  • 53
  • 154
  • 253

3 Answers3

3

CasperJS works with PhantomJS which is node-independent. Although you can install certain node modules (like underscore) it just won't work out of the box. If you want to use CasperJS with Node.js try SpookyJS.

Some links that might help you -

http://docs.casperjs.org/en/latest/writing_modules.html
http://docs.casperjs.org/en/latest/faq.html

vinayr
  • 11,026
  • 3
  • 46
  • 42
  • 1
    I remember I tried Spooky last and this was the issue since I run Windows "Spooky's stdio transport reportedly does not work on Windows and Ubuntu." – HP. Aug 31 '13 at 03:55
  • 1
    Here is the latest issue on Windows https://github.com/WaterfallEngineering/SpookyJS/issues/71 – HP. Aug 31 '13 at 04:04
2

I had the same issue and found a work around. https://stackoverflow.com/a/21246476/394811

./proxies/underscore.js:

module.exports = require('underscore');

./tests/test.js

var _ = require('../proxies/underscore');
Community
  • 1
  • 1
Kylee
  • 1,625
  • 1
  • 31
  • 54
0

It works for me. --includes=foo.js,bar.js will include the foo.js and bar.js files before each test file execution.

Hasan
  • 188
  • 8