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