-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
46 lines (40 loc) · 956 Bytes
/
gulpfile.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
var gulp = require('gulp'),
mocha = require('gulp-mocha'),
jscs = require('gulp-jscs'),
istanbul = require('gulp-istanbul');
gulp.task('default', function() {
console.log('Now, start writing gulp configuration.');
});
gulp.task('serve', function() {
throw 'Not implmtd';
});
gulp.task('test', ['coverage'], function() {
return gulp.src('api/test/**/*.spec.js')
.pipe(mocha({
reporter : 'mocha-better-spec-reporter',
require : ['./api/test/init']
}))
.on('error', _handleError)
.once('end', function() {
process.exit();
});
});
gulp.task('qa', function() {
return gulp.src([
'api/**/*.js',
'!api/coverage/**/*.js'
])
.pipe(jscs())
.pipe(jscs.reporter());
});
gulp.task('coverage', function() {
return gulp.src([
'api/**/*.js'
])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
function _handleError(err) {
console.log(err.toString());
this.emit('end');
}