Gruntjs 警告:任务“;mochatest“;找不到

Gruntjs 警告:任务“;mochatest“;找不到,gruntjs,mocha.js,Gruntjs,Mocha.js,通过grunt mochaTest运行代码时,我遇到以下错误: 警告:未找到任务“mochaTest”。使用--force继续 将grunt.loadTasks更改为grunt.loadNpmTasks 这应该可以纠正你的错误 有关更多信息,请参阅 module.exports = function(grunt) { grunt.loadTasks('grunt-mocha-test'); grunt.loadTasks('grunt-contrib-watch'); g

通过grunt mochaTest运行代码时,我遇到以下错误:

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


grunt.loadTasks
更改为
grunt.loadNpmTasks

这应该可以纠正你的错误

有关更多信息,请参阅

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']);
};