-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgruntfile.js
executable file
·120 lines (113 loc) · 2.58 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
'use strict';
module.exports = function(grunt) {
var files = {
serverJS: ['gruntfile.js', 'server.js', 'config/**/*.js', 'app/**/*.js', 'app/**/*.js'],
mochaTests: ['tests/mocha/*.test.js'],
};
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
serverJS: {
files: files.serverJS,
tasks: ['jshint'],
options: {
livereload: true
}
},
},
jshint: {
all: {
src: files.serverJS,
options: {
jshintrc: true
}
}
},
nodemon: {
dev: {
script: 'server.js',
options: {
nodeArgs: ['--debug'],
ext: 'js',
watch: files.serverJS
}
}
},
'node-inspector': {
custom: {
options: {
'web-port': 1337,
'web-host': 'localhost',
'debug-port': 5858,
'save-live-edit': true,
'no-preload': true,
'stack-trace-limit': 50,
'hidden': []
}
}
},
concurrent: {
default: ['nodemon', 'watch'],
debug: ['nodemon', 'watch', 'node-inspector'],
options: {
logConcurrentOutput: true,
limit: 10
}
},
env: {
test: {
NODE_ENV: 'test'
},
secure: {
NODE_ENV: 'secure'
},
coverage: {
NODE_ENV: 'coverage',
}
},
mochaTest: {
src: files.mochaTests,
options: {
require: './server',
reporter: 'spec'
},
},
mocha_istanbul: {
coverage: {
src: 'tests/mocha',
options: {
require: './server',
check: {
lines: 20,
statements: 20
},
}
},
coveralls: {
src: 'tests/mocha',
options: {
coverage:true,
check: {
lines: 20,
statements: 20
},
root: './app',
reportFormats: ['cobertura','lcovonly'],
}
}
},
});
require('load-grunt-tasks')(grunt);
grunt.event.on('coverage', function(lcov, done){
require('coveralls').handleInput(lcov, function(err){
if (err) {
return done(err);
}
done();
});
});
grunt.registerTask('default', ['concurrent:default']);
grunt.registerTask('test', ['env:test', 'jshint', 'mochaTest']);
grunt.registerTask('travis', ['env:test', 'jshint', 'mocha_istanbul:coveralls']);
grunt.registerTask('coverage', ['env:coverage', 'mocha_istanbul:coverage']);
};