-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
109 lines (105 loc) · 2.88 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
// Generated on 2016-03-06 using generator-nodejs 3.2.0
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
complexity: {
generic: {
src: ['app/**/*.js'],
options: {
errorsOnly: false,
cyclometric: 6, // default is 3
halstead: 16, // default is 8
maintainability: 100 // default is 100
}
}
},
jshint: {
all: [
'Gruntfile.js',
'app/**/*.js',
'src/**/*.js',
'test/**/*.js'
],
options: {
jshintrc: '.jshintrc'
}
},
mochacli: {
all: ['test/**/*.js'],
options: {
reporter: 'spec',
ui: 'tdd'
}
},
watch: {
js: {
files: ['**/*.js', '!node_modules/**/*.js'],
tasks: ['default'],
options: {
nospawn: true
}
}
},
env: {
coverage: {
APP_DIR_FOR_CODE_COVERAGE: '../test'
}
},
/*jshint camelcase: false */
mocha_istanbul: {
coverage: {
src: 'test', // a folder works nicely
options: {
mask: '*.js'
}
},
coveralls: {
src: ['test'], // multiple folders also works
options: {
coverage:true, // this will make the grunt.event.on('coverage') event listener to be triggered
check: {
lines: 100,
statements: 100
},
root: './src', // define where the cover task should consider the root of libraries that are covered by tests
reportFormats: ['cobertura','lcovonly']
}
}
},
istanbul_check_coverage: {
default: {
options: {
coverageFolder: 'coverage*', // will check both coverage folders and merge the coverage results
check: {
lines: 80,
statements: 80
}
}
}
},
coveralls: {
options: {
force: false
},
coverallsJsrules: {
src: 'coverage/*.info'
}
}
});
grunt.event.on('coverage', function(lcovFileContents, done){
// Check below on the section "The coverage event"
done();
});
grunt.loadNpmTasks('grunt-mocha-istanbul');
//grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']);
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('coverage', ['mocha_istanbul:coverage']);
grunt.loadNpmTasks('grunt-coveralls');
grunt.loadNpmTasks('grunt-complexity');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-mocha-cli');
grunt.registerTask('test', ['complexity', 'jshint', 'mocha_istanbul:coverage', 'watch']);
grunt.registerTask('ci', ['complexity', 'jshint', 'mocha_istanbul:coverage']);
grunt.registerTask('default', ['test']);
};