-
Notifications
You must be signed in to change notification settings - Fork 11
/
grunt.js
92 lines (85 loc) · 1.97 KB
/
grunt.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
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-shell');
function getLintConfig() {
return {
options: {
curly: true,
eqeqeq: true,
immed: true,
latedef: true,
newcap: true,
noarg: true,
sub: true,
undef: true,
boss: true,
eqnull: true,
es5: true,
strict: false
},
globals: {
}
};
}
function getNodeLintConfig() {
var config = getLintConfig();
config.options.node = true;
return config;
}
function getNodeTestLintConfig() {
var config = getNodeLintConfig();
config.globals.describe = false;
config.globals.it = false;
config.globals.before = false;
config.globals.after = false;
return config;
}
// Project configuration.
grunt.initConfig({
lint: {
node: ['grunt.js', 'src/**/*.js'],
nodeTest: ['test/src/**/*.js', 'test/integration/**/*.js']
},
jshint: {
node: getNodeLintConfig(),
nodeTest: getNodeTestLintConfig()
},
mochaTest: {
test: ['test/src/**/*.js', 'test/integration/**/*.js'],
doc: ['test/src/**/*.js']
},
mochaTestConfig: {
test: {
options: {
reporter: 'nyan'
}
},
doc: {
options: {
reporter: 'doc'
}
}
},
shell: {
generateKeys: {
command: (process.platform === 'win32') ? '.\\keys.bat' : './keys.sh',
execOptions: {
cwd: './test/keys'
}
},
_options: {
stdout: true,
stderr: true,
failOnError: true
},
},
watch: {
files: ['grunt.js', 'src/**/*.js', 'test/src/**/*.js', 'test/integration/**/*.js'],
tasks: ['default']
}
});
// Default task.
grunt.registerTask('default', 'lint shell:generateKeys mochaTest:test');
// Documentation task.
grunt.registerTask('doc', 'mochaTest:doc');
};