1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 | module.exports = function(grunt) {
|
7 |
|
8 | var gruntfileSrc = 'gruntfile.js';
|
9 | var testSrc = 'test/**/*.spec.js';
|
10 | var libSrc = 'lib/**/*.js';
|
11 |
|
12 | grunt.initConfig({
|
13 |
|
14 | cafemocha: {
|
15 | options: {
|
16 | reporter: 'spec'
|
17 | },
|
18 | all: {
|
19 | src: testSrc
|
20 | }
|
21 | },
|
22 |
|
23 | jshint: {
|
24 | options: {
|
25 | jshintrc: '.jshintrc'
|
26 | },
|
27 | gruntfile: {
|
28 | src: gruntfileSrc
|
29 | },
|
30 | tests: {
|
31 | options: {
|
32 | jshintrc: 'test/.jshintrc'
|
33 | },
|
34 | src: testSrc
|
35 | },
|
36 | lib: {
|
37 | src: libSrc
|
38 | }
|
39 | },
|
40 |
|
41 | watch: {
|
42 | tests: {
|
43 | files: testSrc,
|
44 | tasks: ['newer:cafemocha']
|
45 | },
|
46 | lib: {
|
47 | files: libSrc,
|
48 | tasks: ['cafemocha']
|
49 | },
|
50 | allJs: {
|
51 | files: [gruntfileSrc, testSrc, libSrc],
|
52 | tasks: ['newer:jshint']
|
53 | }
|
54 | }
|
55 |
|
56 | });
|
57 |
|
58 | grunt.loadNpmTasks('grunt-contrib-jshint');
|
59 | grunt.loadNpmTasks('grunt-contrib-watch');
|
60 | grunt.loadNpmTasks('grunt-cafe-mocha');
|
61 | grunt.loadNpmTasks('grunt-newer');
|
62 |
|
63 | grunt.registerTask('test', ['newer:jshint', 'cafemocha']);
|
64 | grunt.registerTask('start', ['test', 'watch']);
|
65 |
|
66 | grunt.registerTask('default', 'test');
|
67 |
|
68 | };
|