Passing cli parameters to casperjs through grunt task and npm test
I'm running tests with npm test - that actually runs a grunt task grunt
casperjs:
casperjs:{
options:{},
files:
['./test_index.js',
'./test_map_regression.js',
'./test_index_get_gush.js'] /
},
using the grunt-casperjs-plugin in order to automate testing with slimerjs
along with phantomjs, both running under casperjs in Travis-ci.
In order to do that, I need to pass the engine as a variable from the
command line. something like:
casperjs --engine=slimerjs test_suite.js
Question: I can't find a way to pass the options from grunt cli (and I
assume npm command line options would delegate to grunt. correctly?) to
the files array.
I tried to add:
var engine = grunt.option('engine') || 'phantomjs';
engine = '--engine='+engine;
and then in the file array do:
files:['./test_index.js '+engine,
'./test_map_regression.js '+enging,
'./test_index_get_gush.js '+engine]
but seems that file array has to get real file names without the added args.
I'll be glad for any ideas on how to solve this through.
No comments:
Post a Comment