-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
60 lines (59 loc) · 1.57 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
'use strict';
module.exports = function (grunt) {
var gruntConfig;
gruntConfig = {
pkg: grunt.file.readJSON('package.json'),
clean: {
default: ['dist', 'tmp']
},
mkdir: {
all: {
options: {
create: ['dist/reports']
}
}
},
jshint: {
options: {
reporter: require('jshint-stylish'),
force: true,
jshintrc: 'jshint.json'
},
src: [
'config/**/*.js',
'lib/**/*.js',
'test/**/*.js'
]
},
mochaTest: {
test: {
options: {
reporter: 'spec'
},
src: ['test/**/*.js']
}
},
exec: {
coverage: {
command: './node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- --ui bdd -R spec -t 5000 test/**/*.js'
}
}
};
if (!process.env.DEBUG) {
process.env.DEBUG = '*:info|warn|error';
}
if (process.env.JENKINS_URL) {
gruntConfig.jshint.options.reporter = 'checkstyle';
gruntConfig.jshint.options.reporterOutput = 'dist/reports/jshint_checkstyle.xml';
gruntConfig.mochaTest.test.options.reporter = 'xunit-file';
gruntConfig.mochaTest.test.options.quiet = false;
process.env.XUNIT_FILE = 'dist/reports/xunit.xml';
}
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.initConfig(gruntConfig);
grunt.registerTask('verify', ['mkdir', 'jshint']);
grunt.registerTask('test', ['mkdir', 'mochaTest']);
grunt.registerTask('cover', ['mkdir', 'exec:coverage']);
grunt.registerTask('default', ['verify', 'test', 'cover']);
};