0
我不明白爲什麼我無法在一個Gruntfile中註冊這兩個測試。當我運行grunt test
時,它運行得非常好。當我運行grunt web
時,它給我Warning: Task "webTest" not found
。每個任務中的代碼完全一樣,爲什麼如果咕嚕只允許一個任務註冊?警告:找不到任務「webTest」
// Gruntfile.js
module.exports = function(grunt){
// Load grunt mocha task
grunt.loadNpmTasks('grunt-mocha');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// webTest
webTest: {
test: {
options: {
reporter: 'list',
timeout: 2000
},
src: ['all.js',
'test/groups.js',
'test/doctors.js',
'test/patients.js',
'test/diet.js']
}
},
// Mocha Test
mochaTest: {
test: {
options: {
reporter: 'list',
timeout: 2000
},
src: ['all.js',
'test/groups.js',
'test/doctors.js',
'test/patients.js',
'test/diet.js']
}
}
});
grunt.registerTask('web', ['webTest']);
grunt.registerTask('test', ['mochaTest']);
};