mocha-casperjs icon indicating copy to clipboard operation
mocha-casperjs copied to clipboard

Clean way of requiring modules

Open windkomo opened this issue 8 years ago • 2 comments

Hello,

Is there a clean way of requiring a node module ?

Currently, I'm using casperjs's utils like this :

var utils = require('../../../node_modules/casperjs/modules/utils');

Before using mocha-casperjs, I was using :

var utils = require('utils');

Any best practice here ?

windkomo avatar May 09 '16 14:05 windkomo

That should work. mocha-casperjs doesn't mess with casper's patched require. Perhaps something regressed in casper's patched require between casper versions?

nathanboktae avatar May 10 '16 04:05 nathanboktae

I have no idea, I was requiring utils just fine, and then reworked tests a bit to use mocha-casperjs, and it stopped working (tests are not run) until I specified the complete path to node_modules.

windkomo avatar May 11 '16 10:05 windkomo