forked from cfpb/hmda-rule-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
96 lines (80 loc) · 2.59 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
'use strict';
module.exports = function (grunt) {
//npm install
grunt.registerTask('npm_install', 'install dependencies', function() {
var exec = require('child_process').exec;
var cb = this.async();
exec('npm install', {cwd: './'}, function(err, stdout) {
console.log(stdout);
cb();
});
});
grunt.registerTask('open_coverage', 'open coverage report in default browser', function() {
var exec = require('child_process').exec;
var cb = this.async();
exec('open coverage/lcov-report/index.html', {cwd: './'}, function(err, stdout) {
console.log(stdout);
cb();
});
});
grunt.initConfig({
//clean node_modules directory except for grunt
clean: {
options:{
// force: true
},
node_modules:["node_modules/*","!node_modules/grunt*"],
coverage:["coverage/*"]
},
env: {
options: {
},
test: {
NODE_ENV: 'test',
XUNIT_FILE: 'coverage/TESTS-all.xml'
}
},
mochaTest: {
test: {
options: {
reporter: 'spec-xunit-file',
timeout: 15000
},
src: ['test/**/*.js']
}
},
mocha_istanbul: {
coverage: {
src: 'test', // the folder name for the tests
options: {
recursive: true,
//quiet: true,
excludes: [],
mochaOptions: [
'--reporter', 'spec-xunit-file'
]
}
}
},
jshint: {
files: [
'engine.js',
'lib/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
});
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-develop');
grunt.loadNpmTasks('grunt-env');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-release');
// Register group tasks
grunt.registerTask('clean_all', [ 'clean:node_modules', 'clean:coverage', 'npm_install' ]);
grunt.registerTask('test', ['env:test', 'clean:coverage', 'jshint', 'mocha_istanbul']);
grunt.registerTask('coverage', ['env:test', 'clean:coverage', 'jshint', 'mocha_istanbul', 'open_coverage' ]);
};