Gruntfile.js
 1  'use strict';
 2  
 3  module.exports = function(grunt) {
 4  
 5    // Project configuration.
 6    grunt.initConfig({
 7      nodeunit: {
 8        files: ['test/**/*_test.js'],
 9      },
10      jshint: {
11        options: {
12          jshintrc: '.jshintrc'
13        },
14        gruntfile: {
15          src: 'Gruntfile.js'
16        },
17        lib: {
18          src: ['lib/**/*.js']
19        },
20        test: {
21          src: ['test/**/*.js']
22        },
23      },
24      watch: {
25        gruntfile: {
26          files: '<%= jshint.gruntfile.src %>',
27          tasks: ['jshint:gruntfile']
28        },
29        lib: {
30          files: '<%= jshint.lib.src %>',
31          tasks: ['jshint:lib', 'nodeunit']
32        },
33        test: {
34          files: '<%= jshint.test.src %>',
35          tasks: ['jshint:test', 'nodeunit']
36        },
37      },
38    });
39  
40    // These plugins provide necessary tasks.
41    grunt.loadNpmTasks('grunt-contrib-nodeunit');
42    grunt.loadNpmTasks('grunt-contrib-jshint');
43    grunt.loadNpmTasks('grunt-contrib-watch');
44  
45    // Default task.
46    grunt.registerTask('default', ['jshint', 'nodeunit']);
47  
48  };