-
Notifications
You must be signed in to change notification settings - Fork 12
/
Gruntfile.js
58 lines (48 loc) · 1.63 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
var grunt = require('grunt');
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.initConfig({
shell: {
serverDemo: {
command: 'node examples/server.js'
},
clientDemo: {
command: 'node examples/client.js'
},
testUnit: {
command: 'node_modules/.bin/mocha test/unit/*.spec.js test/unit/**/*.spec.js'
},
jshint: {
command: 'find lib test -not -path \'test/reports/*\' -name \'*.js\' | xargs jshint'
},
browserify: {
command: 'browserify index.js -s SAME -o bundle/SAME.js'
}
},
mocha_istanbul: {
coverage: {
src: 'test/unit',
options: {
coverageFolder: 'test/reports/',
mask: '*.spec.js'
}
}
}
});
grunt.registerTask('browserify', 'Bundle the library for browsers',
['shell:browserify']);
grunt.registerTask('demo:client', 'Run the client-side demo server',
['browserify', 'shell:clientDemo']);
grunt.registerTask('demo:server', 'Run the server-side demo',
['shell:serverDemo']);
grunt.registerTask('jshint', 'Run jshint check',
['shell:jshint']);
grunt.registerTask('test', 'Run unit tests',
['shell:testUnit']);
grunt.registerTask('cover', 'Run unit tests + coverage report',
['mocha_istanbul:coverage']);
grunt.registerTask('validate', 'Run all checks and generate coverage',
['shell:jshint',
'mocha_istanbul:coverage']);
};