我无法弄清楚为什么我不能在一个Gruntfile中注册这两个测试。当我运行grunt test
时,它运行得非常好。当我运行grunt web
时,它会给我Warning: Task "webTest" not found
。每个任务中的代码完全相同,那么为什么如果grunt只允许一个任务注册?
// 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']);
};
答案 0 :(得分:0)
想出来:
<div class="print-report-footer" ng-show="vm.clicked">
<button type="button" class="btn btn-primary" ng-click="vm.downloadFile('pdf')">PDF</button>
<button type="button" class="btn btn-primary" ng-click="vm.downloadFile('xls')">XLS</button>
<button type="button" class="btn btn-primary" ng-click="vm.downloadFile('csv')">CSV</button>
</div>