2015-07-20 56 views
0

基礎上grunt.options documentation,我期待能夠以編程開始咕嚕任務與force選項打開,像這樣:grunt.option(「力」,真)不工作

var grunt = require('grunt'); 
grunt.option('force', true); 
grunt.tasks(['test']); 

我的預期這相當於從命令行運行grunt test --force。但force選項沒有被應用:

Warning: Task "karma:unit" failed. Use --force to continue. 

如何以編程開始與force選項咕嚕任務啓用?

回答

0

我能夠以不同的方式完成我想要做的事情。相反,編程設置force選項的,我現在使用的grunt-force插件設置爲force = true我的任務的其餘部分:

grunt.registerTask('build', 'Builds the app.', ['force:on', 'typescript:main', ...etc]); 

我會很樂意接受一個更直接的答案,我原來的問題,如果有人知道解。