forked from kalabox/kalabox
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Gruntfile.js
174 lines (151 loc) · 4 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
'use strict';
module.exports = function(grunt) {
//--------------------------------------------------------------------------
// SETUP CONFIG
//--------------------------------------------------------------------------
// setup task config
var config = {
// Arrays of relevant code classified by type
files: {
js: {
src: [
'lib/**/*.js',
'plugins/**/*.js',
'plugins/**/**/*.js',
'test/**/*.js',
'bin/kbox.js',
'scripts/*.js'
]
}
},
clean: {
coverage: ['coverage']
},
shell: {
// @todo: Maybe remove the .istanbul.yml file and put config here
testUnit: {
command:
'node_modules/istanbul/lib/cli.js ' +
'test ' +
'node_modules/mocha/bin/_mocha ' +
'./test/'
},
testLarge: {
command: 'node_modules/mocha/bin/_mocha --bail test_large'},
testCoverage: {
command:
'node_modules/istanbul/lib/cli.js ' +
'cover node_modules/mocha/bin/_mocha ./test/'},
testCheckCoverage: {
command:
'node_modules/istanbul/lib/cli.js ' +
'check-coverage coverage/coverage.json ' +
'--statements ' + 0 +
' --branches ' + 0 +
' --functions ' + 0 +
' --lines ' + 0
},
functionalTest: {
command: 'time node ftest/ftest.js'
}
},
// This handles automatic version bumping in travis
bump: {
options: {
files: ['package.json'],
updateConfigs: [],
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'bower.json'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false
}
},
// Some linting and code standards
jshint: {
options: {
jshintrc: '.jshintrc',
reporter: require('jshint-stylish')
},
all: ['Gruntfile.js', '<%= files.js.src %>']
},
jscs: {
src: ['Gruntfile.js', '<%= files.js.src %>'],
options: {
config: '.jscsrc'
}
},
jsdoc: {
safe: {
src: [
'README.md',
'lib/app.js',
'lib/core/*.js',
'lib/create.js',
'lib/engine.js',
'lib/engine/provider.js',
'lib/install.js',
'lib/kbox.js',
'lib/services.js',
'lib/update.js',
'lib/util/*.js'
],
options: {
destination: 'doc',
template: 'node_modules/jsdoc-oblivion/template',
configure : '.jsdoc.conf.json'
}
}
},
watch: {
// bcauldwell: I'm just using this to make developing unit tests easier.
unit: {
files: ['**/*.js'],
tasks: ['unit']
}
}
};
//--------------------------------------------------------------------------
// LOAD TASKS
//--------------------------------------------------------------------------
// load task config
grunt.initConfig(config);
// load external tasks
//grunt.loadTasks('tasks');
// load grunt-* tasks from package.json dependencies
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks);
//--------------------------------------------------------------------------
// SETUP WORKFLOWS
//--------------------------------------------------------------------------
// unit testing
grunt.registerTask('unit', [
'shell:testUnit'
]);
// functional testing
grunt.registerTask('ftest', [
'shell:functionalTest'
]);
// testing code coverage
grunt.registerTask('coverage', [
'clean:coverage',
'shell:testCoverage',
'shell:testCheckCoverage'
]);
grunt.registerTask('bump-patch', [
'bump-only:patch'
]);
grunt.registerTask('test', [
'unit',
'coverage'
]);
// large functional testing
grunt.registerTask('test:large', [
'shell:testLarge'
]);
grunt.registerTask('test:code', [
'jshint',
'jscs'
]);
};