-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathGruntfile.js
119 lines (116 loc) · 2.52 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
110
111
112
113
114
115
116
117
118
var grunt = require("grunt");
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-release');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-istanbul');
grunt.initConfig({
watch: {
scripts: {
files: ['src/**/*.js', '*.js', 'tests/*.js'
],
tasks: ['all'],
options: {
spawn: false
}
}
},
instrument: {
files: ['src/**/*.js','tests/**/*.js'],
options: {
lazy: false,
basePath: '.coverage'
}
},
jshint: {
all: ['src/**/*.js', '*.js', 'tests/**/*.js'],
options:{
esnext:true
}
},
mochaTest: {
test: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['tests/basic_test.js']
},
testCancel: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['tests/cancel_test.js']
},
testRedis: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['tests/basic_redis_test.js']
},
testAll: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['tests/**/*_test.js','!tests/cancel_test.js','!tests/basic_test.js', '!tests/basic_redis_test.js']
},
cov: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['.coverage/tests/basic_test.js']
},
covCancel: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['.coverage/tests/cancel_test.js']
},
covRedis: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['.coverage/tests/basic_redis_test.js']
},
covAll: {
options: {
reporter: 'spec',
clearRequireCache:true
},
src: ['.coverage/tests/**/*_test.js','!.coverage/tests/cancel_test.js','!.coverage/tests/basic_test.js','!.coverage/tests/basic_redis_test.js']
}
},
storeCoverage: {
options: {
dir: '.coverage/reports'
}
},
makeReport: {
src: '.coverage/reports/**/*.json',
options: {
type: 'html',
dir: '.coverage/reports',
print: 'both'
}
},
release: {
options: {
bump: true,
npm: true,
npmTag: "<%= version %>"
}
}
});
grunt.registerTask("cov-test", [ "instrument","mochaTest:cov","mochaTest:covCancel","mochaTest:covAll", "mochaTest:covRedis",'storeCoverage',
'makeReport']);
grunt.registerTask("test", ["mochaTest:test","mochaTest:testCancel","mochaTest:testAll","mochaTest:testRedis"]);
grunt.registerTask("coverage", ["jshint","cov-test"]);
grunt.registerTask("all", ["jshint", "test"]);
grunt.registerTask("default", ["all", "watch"]);
grunt.registerTask("prod", ["all", "release"]);