Grunt 未找到 "qunit" 个目标
Grunt no "qunit" targets found
配置 g运行t 以使用 jenkins 和 qunit 进行自动化 JS 测试,我实际上正在阻止这个问题。
当我运行g运行t:
运行 "qunit_junit" 任务
XML reports will be written to _build/test-reports
No "qunit" targets found.
Warning: Task "qunit" failed. Use --force to continue.
Aborted due to warnings.
我的 G运行t 文件:
'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(),安装了 g运行t-contrib-qunit 并且任务在其中所以 g运行 t 找到模块和任务,但似乎没有加载它。
一目了然 - 您正在创建配置,但未对它执行任何操作。
更改此行
grunt.initConfig({
sync: {
target: {}
}
});
对此:
grunt.initConfig(gruntConfig);
您可能还想将它移到您添加到 gruntConfig 的所有其他内容下方。
配置 g运行t 以使用 jenkins 和 qunit 进行自动化 JS 测试,我实际上正在阻止这个问题。
当我运行g运行t: 运行 "qunit_junit" 任务
XML reports will be written to _build/test-reports No "qunit" targets found. Warning: Task "qunit" failed. Use --force to continue.
Aborted due to warnings.
我的 G运行t 文件:
'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(),安装了 g运行t-contrib-qunit 并且任务在其中所以 g运行 t 找到模块和任务,但似乎没有加载它。
一目了然 - 您正在创建配置,但未对它执行任何操作。
更改此行
grunt.initConfig({
sync: {
target: {}
}
});
对此:
grunt.initConfig(gruntConfig);
您可能还想将它移到您添加到 gruntConfig 的所有其他内容下方。