iamchrismiller / grunt-casper

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

[Bug] Problem with supportedEngines and the engine option #37

Closed rochejul closed 10 years ago

rochejul commented 10 years ago

Hi,

I defined the engine option onto the grunt task. However, I can see the followwing error:

>> Engine phantomjs not available. [phantomjs,slimerjs]

When we look into the casper.js file, we can see the following code:

if (self.supportedEngines.indexOf(options['engine'])) {
    spawnOpts.push('--engine=' + options['engine']);
} else {
    grunt.log.warn('Engine ' + options['engine'] + ' not available. [' + self.supportedEngines.join(',') + ']');
}

if the 'indexOf' returns 0, the condition will fail (like '', null, undefined, false). So, we have to replace with the following code:

if (self.supportedEngines.indexOf(options['engine']) >= 0) {
    spawnOpts.push('--engine=' + options['engine']);
} else {
    grunt.log.warn('Engine ' + options['engine'] + ' not available. [' + self.supportedEngines.join(',') + ']');
}

Thank for you feedbacks

Cheers

Julien Roche

iamchrismiller commented 10 years ago

ahh, looks like a late night oversight. I have fixed it and published 0.3.5.. Thank you for pointing this out.