我正在使用grunt-karma启动单元测试套件。我需要从grunt任务中查找一个值,然后将该值传递给业力以用于测试。
执行任务的咕doing声:
grunt.registerMultiTask('lookup', 'Lookup value', function() {
var value = 5; // just hard code here for now
然后,我需要将值传递给定义的grunt-karma任务:
karma: {
options: {
configFile: 'karma.conf.js'
},
我可以使用grunt.config将值传递给karma-runner吗?
var value = 5; //just hardcode here for now
...
grunt.config("karma.customParam",value);
然后如何从测试规格中检索值?
我知道这个答案为时已晚。但我希望它能帮助某人。
karma: {
options: {
configFile: 'karma.conf.js',
client: {
args: ['test']
}
},
在测试规范中,您可以检索如下所示的值
window.__karma__.config.args[0] // 'test'
谢谢。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句