-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathgruntfile.js
62 lines (59 loc) · 1.54 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
var grunt = require("grunt");
grunt.initConfig({
jshint: {
all: ['src/**/*.js', '*.js', 'spec/**/*.js', '*.js'],
options: {
undef: true,
node: true,
globals: {
require: true,
module: true,
setTimeout: true,
__dirname: true,
process: true,
setInterval: true,
/* MOCHA */
it: true,
describe: true,
before: true,
beforeEach: true,
after: true,
afterEach: true
}
}
},
mochaTest: {
test: {
options: {
reporter: 'spec',
//captureFile: 'results.txt', // Optionally capture the reporter output to a file
quiet: false, // Optionally suppress output to standard out (defaults to false)
clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false)
},
src: ['spec/**/*.js']
}
},
mocha_istanbul: {
coverage: {
src: 'spec'
}
},
watch: {
scripts: {
files: ['src/*.js', 'spec/*.js'],
tasks: ['test'],
options: {
spawn: false
}
}
}
});
//Load modules
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-mocha-istanbul');
grunt.loadNpmTasks('grunt-contrib-watch');
// Register tasks
grunt.registerTask('default', ['jshint:all', 'mochaTest', 'mocha_istanbul:coverage', 'watch']);
grunt.registerTask('test', ['jshint:all', 'mochaTest', 'mocha_istanbul:coverage']);
grunt.registerTask('coverage', ['mocha_istanbul:coverage']);