UNPKG

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