[英]Grunt no “qunit” targets found
配置grunt以使用jenkins和qunit進行自動化JS測試,我實際上在這個問題上受阻。
當我運行grunt時:運行“ qunit_junit”任務
XML報告將被寫入_build / test-reports未找到“ qunit”目標。 警告:任務“ qunit”失敗。 使用--force繼續。
Aborted due to warnings.
我的Gruntfile:
'use strict';
module.exports = function(grunt) {
var gruntConfig = {};
grunt.initConfig({
sync: {
target: {}
}
});
grunt.registerTask('default', ['qunit_junit', 'qunit']);
grunt.loadNpmTasks('grunt-contrib-qunit');
grunt.loadNpmTasks('grunt-qunit-istanbul');
gruntConfig.qunit = {
src: ['static/test/index.html'],
options: {
coverage: {
src: ['static/js/**/*.js'],
instrumentedFiles: 'temp/',
htmlReport: 'report/coverage',
coberturaReport: 'report/',
linesThresholdPct: 20
}
}
};
grunt.loadNpmTasks('grunt-qunit-junit');
gruntConfig.qunit_junit = {
options: {
dest: 'report/'
}
};
};
我檢查了node_modules中的console.log(),安裝了grunt-contrib-qunit並且任務在其中,因此grunt找到了模塊和任務,但似乎沒有加載它。
乍一看-您正在創建配置,但不對其進行任何操作。
更改此行
grunt.initConfig({
sync: {
target: {}
}
});
對此:
grunt.initConfig(gruntConfig);
您可能還想將其移至添加到gruntConfig的所有其他內容之下。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.