在我的gruntfile中,我必须将文件路径硬编码为任务的参数(selenium-server-standalone.jar,对于任何想知道的人)。这个目录中只有一个文件,但是当它更新时,版本号后缀会发生变化(selenium-server-standalone-x.xx.x.jar)。有没有办法在运行此任务之前以某种方式计算文件路径字符串并以某种方式将其包含为变量?
编辑:这是我的gruntfile中有问题的一块。seleniumServerJar
不接受数组
//config for grunt-protractor-runner
protractor: {
options: {
configFile: 'test/protractor.conf.js',
singleRun: false,
keepAlive: false,
noColor: false,
args: {
//DANGER DANGER DANGER!!! HARDCODED STRINGS
//THIS WILL DIE WITH WEBDRIVER-MANGER UPDATE !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
seleniumServerJar: 'node_modules/protractor/selenium/selenium-server-standalone-2.42.2.jar',
chromeDriver: 'node_modules/protractor/selenium/chromedriver'
}
},
run: {}
}