iamchrismiller / grunt-casper

Run CasperJS Scripts/Functional Tests
Other
69 stars 38 forks source link

Can not override Phantom JS executable #67

Open jeffski opened 9 years ago

jeffski commented 9 years ago

The README says you can override the Casper/Phantom binaries like this:

process.env.PHANTOMJS_EXECUTABLE = '/path/to/phantomjs';
process.env.CASPERJS_EXECUTABLE = '/path/to/casperjs';

This works for Casper JS and it is obvious from the code that this will work.

It doesn't seem to work for Phantom JS though and the code looks like it will only fall back on the binary if the node module is not found.

I quickly hacked tasks/lib/casper.js like below, which worked, but probably a better way:

//npm install wrapper
if (process.env["PHANTOMJS_EXECUTABLE"] && fs.existsSync(process.env["PHANTOMJS_EXECUTABLE"])) {
    var phantomjs = process.env["PHANTOMJS_EXECUTABLE"];
} else {
    var phantomjs = require('phantomjs');
}

It would be great if this could be fixed so that you can specify the binary as an override and not a fallback. As a bonus it would be good if SlimerJS could be overwritten too.