-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
69 lines (64 loc) · 1.78 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
'use strict';
module.exports = function(grunt) {
// Unified Watch Object
var watchFiles = {
serverJS: ['Gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js'],
clientJS: ['public/*.js', 'public/modules/**/*.js'],
mochaTests: ['app/tests/**/*.js']
};
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: {
src: watchFiles.clientJS.concat(watchFiles.serverJS),
options: {
jshintrc: true
}
},
test: {
src: watchFiles.mochaTests,
options: {
jshintrc: true
}
}
},
nodemon: {
dev: {
script: 'server.js',
options: {
ext: 'js,html',
watch: watchFiles.serverJS
}
}
},
env: {
development: {
NODE_ENV: 'development'
},
test: {
NODE_ENV: 'test'
}
},
mochaTest: {
test: {
options: {
reporter: 'spec',
require: ['server']
},
src: watchFiles.mochaTests
}
},
karma: {
unit: {
configFile: 'karma.conf.js',
browsers: ['PhantomJS']
}
}
});
require('load-grunt-tasks')(grunt);
// Default task(s).
grunt.registerTask('default', ['jshint', 'test', 'run-dev']);
grunt.registerTask('run-dev', ['env:development', 'nodemon']);
grunt.registerTask('test', ['env:test', 'mochaTest', 'karma']);
};