繁体   English   中英

对“ qunit”目标不满

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM