-
Notifications
You must be signed in to change notification settings - Fork 4
/
Gruntfile.js
71 lines (60 loc) · 2.32 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
module.exports = function(grunt) {
grunt.initConfig({
//our JSHint options
jshint: {
all: [ 'client/default/*.js',
'client/default/app/**/*.js',
'client/default/js/*.js',
'client/test/tests/*.js'
] //files to lint
},
mocha_phantomjs: {
options: {
'reporter': 'spec',
'output': 'client/test/result.xml'
},
all: ['client/test/index.html']
},
nodeunit: {
files: ['cloud/tests/*.js']
},
bgShell: {
_defaults: {
bg: false,
fail:true
},
instrumentJS: { // remove old inst folder, and create new one
cmd: 'rm -R client/default-inst && jscoverage client/default client/default-inst'
},
inst: { // create inst folder
cmd: 'jscoverage client/default client/default-inst'
},
noInst: { // delete inst folder only
cmd: 'rm -R client/default-inst'
},
json: { // generate json report, and output to file
cmd: 'mocha-phantomjs -R json-cov client/test/index.html > report.json'
},
html: { // convert json report to html report
cmd: 'cat report.json | json2htmlcov > report.html'
},
rmFiles: { // remove json file
cmd: 'rm report.json'
},
less: { // compile less files into css
cmd: 'lessc client/default/less/styles.less > client/default/css/styles.css'
}
}
});
//load our tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-phantomjs');
grunt.loadNpmTasks('grunt-contrib-nodeunit');
grunt.loadNpmTasks('grunt-bg-shell');
// --------- TASKS AVAILABLE FROM TERMINAL ------------
grunt.registerTask('test', ['jshint', 'mocha_phantomjs', 'nodeunit']);
grunt.registerTask('coverage', ['bgShell:instrumentJS','bgShell:json','bgShell:html', 'bgShell:rmFiles']);
grunt.registerTask('less', ['bgShell:less']);
grunt.registerTask('inst', ['bgShell:inst']);
grunt.registerTask('noInst', ['bgShell:noInst']);
};