2012-10-17 06:25:07 +08:00
|
|
|
/*
|
|
|
|
* grunt-contrib-watch
|
|
|
|
* http://gruntjs.com/
|
|
|
|
*
|
2016-01-05 09:17:42 +08:00
|
|
|
* Copyright (c) 2016 "Cowboy" Ben Alman, contributors
|
2012-10-17 06:25:07 +08:00
|
|
|
* Licensed under the MIT license.
|
|
|
|
*/
|
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
module.exports = function(grunt) {
|
|
|
|
grunt.initConfig({
|
|
|
|
jshint: {
|
|
|
|
all: [
|
|
|
|
'Gruntfile.js',
|
2013-03-19 01:39:59 +08:00
|
|
|
'tasks/**/*.js',
|
2013-08-07 00:57:48 +08:00
|
|
|
'<%= nodeunit.tests %>',
|
2012-10-17 06:25:07 +08:00
|
|
|
],
|
|
|
|
options: {
|
2013-08-07 00:57:48 +08:00
|
|
|
jshintrc: '.jshintrc',
|
|
|
|
},
|
2012-10-17 06:25:07 +08:00
|
|
|
},
|
2014-11-04 09:38:53 +08:00
|
|
|
jscs: {
|
|
|
|
src: ['tasks/**/*.js', 'test/tasks/**/*.js'],
|
|
|
|
options: {
|
|
|
|
config: '.jscsrc'
|
|
|
|
}
|
|
|
|
},
|
2012-10-17 06:25:07 +08:00
|
|
|
watch: {
|
|
|
|
all: {
|
|
|
|
files: ['<%= jshint.all %>'],
|
2013-04-17 12:41:03 +08:00
|
|
|
tasks: ['jshint', 'nodeunit'],
|
2013-03-19 01:39:59 +08:00
|
|
|
},
|
2012-10-17 06:25:07 +08:00
|
|
|
},
|
|
|
|
nodeunit: {
|
2013-08-07 00:57:48 +08:00
|
|
|
tests: ['test/tasks/*_test.js'],
|
|
|
|
},
|
2013-07-12 03:51:23 +08:00
|
|
|
});
|
2012-10-17 06:25:07 +08:00
|
|
|
|
2013-07-12 03:51:23 +08:00
|
|
|
// Dynamic alias task to nodeunit. Run individual tests with: grunt test:events
|
|
|
|
grunt.registerTask('test', function(file) {
|
2014-11-07 10:04:14 +08:00
|
|
|
grunt.task.run('jshint');
|
2014-11-04 09:38:53 +08:00
|
|
|
grunt.task.run('jscs');
|
2013-07-12 03:51:23 +08:00
|
|
|
grunt.config('nodeunit.tests', String(grunt.config('nodeunit.tests')).replace('*', file || '*'));
|
|
|
|
grunt.task.run('nodeunit');
|
2012-10-17 06:25:07 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
grunt.loadTasks('tasks');
|
|
|
|
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-nodeunit');
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-internal');
|
2014-11-04 09:38:53 +08:00
|
|
|
grunt.loadNpmTasks('grunt-jscs');
|
2012-10-17 06:25:07 +08:00
|
|
|
|
2014-08-30 20:22:48 +08:00
|
|
|
grunt.registerTask('default', ['test', 'build-contrib']);
|
2012-10-17 06:25:07 +08:00
|
|
|
};
|