-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gruntfile.js
66 lines (52 loc) · 1.38 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
'use strict';
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.initConfig({
settings: {
},
clean: {
node: ['./node_modules'],
coverage: {
src: ['./coverage']
}
},
env : {
options : {
},
test : {
NODE_ENV : 'test'
}
},
exec: {
istanbul: {
cmd: function () {
var files = [
grunt.file.expand('database/tests/*.js').join(' '),
grunt.file.expand('database/models/tests/*.js').join(' '),
grunt.file.expand('tests/*.js').join(' ')
];
var cover = 'istanbul cover --x "" node_modules/mocha/bin/_mocha -- --timeout 60000 --reporter spec' + files.join(' ');
var report = 'istanbul' + ' report ' + 'cobertura';
return cover + ' && ' + report;
}
}
},
cafemocha: {
options: {
reporter: (process.env.MOCHA_REPORTER || 'spec'),
timeout: 20000,
colors: true,
debug: true
},
all: {
src: ['tests/*.js', '!node_modules/**/*.js']
}
},
});
grunt.registerTask('coverage', ['clean:coverage', 'env:test', 'exec:istanbul']);
grunt.registerTask('test', 'Run Tests', function () {
grunt.task.run(['env:test', 'cafemocha:all']);
});
grunt.registerTask('default', ['test']);
};