[英]Grunt no “qunit” targets found
Configuring grunt to make automated JS tests with jenkins and qunit, I am actually blocking on this issue. 配置grunt以使用jenkins和qunit进行自动化JS测试,我实际上在这个问题上受阻。
When I run grunt: Running "qunit_junit" task 当我运行grunt时:运行“ qunit_junit”任务
XML reports will be written to _build/test-reports No "qunit" targets found.
XML报告将被写入_build / test-reports未找到“ qunit”目标。 Warning: Task "qunit" failed.
警告:任务“ qunit”失败。 Use --force to continue.
使用--force继续。
Aborted due to warnings.
My Gruntfile: 我的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/'
}
};
};
I checked and console.log() in the node_modules, the grunt-contrib-qunit is installed and the task is in it so grunt finds the module and the task but seems not to load it. 我检查了node_modules中的console.log(),安装了grunt-contrib-qunit并且任务在其中,因此grunt找到了模块和任务,但似乎没有加载它。
Just at a glance - you are creating your config, but not doing anything with it. 乍一看-您正在创建配置,但不对其进行任何操作。
Change this line 更改此行
grunt.initConfig({
sync: {
target: {}
}
});
to this: 对此:
grunt.initConfig(gruntConfig);
You might also want to move that down below all the other stuff you add to gruntConfig. 您可能还想将其移至添加到gruntConfig的所有其他内容之下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.