【问题标题】:Warning: Task "mochatest" not found警告:找不到任务“mochatest”
【发布时间】:2016-03-18 02:45:46
【问题描述】:

通过 grunt mochaTest 运行我的代码时,我收到了这个错误:

警告:找不到任务“mochaTest”。使用 --force 继续。

module.exports = function(grunt) {
    grunt.loadTasks('grunt-mocha-test');
    grunt.loadTasks('grunt-contrib-watch');
    grunt.initConfig({
        mochaTest: {
            test: {
                options: {
                    reporter: 'spec',
                    clearRequireCache: true
                },
                src: ['test/**/*.js']
            },
        },
        watch: {
            scripts: {
                files: ['**/*.js'],
                tasks: ['mochaTest']
            }
        }
    });
    grunt.registerTask('test', ['mochaTest']);
};

【问题讨论】:

    标签: gruntjs mocha.js


    【解决方案1】:

    将grunt.loadTasks 更改为grunt.loadNpmTasks。

    这应该可以解决您的错误。

    请参阅Grunt docs 了解更多信息。

    【讨论】:

      猜你喜欢
      • 2015-10-25
      • 1970-01-01
      • 1970-01-01
      • 2015-09-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多