-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
37 lines (32 loc) · 839 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
var pkg = require("./package.json");
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var gutil = require('gulp-util');
var mocha = require('gulp-mocha');
var watching = false;
var onError = function (err) {
if (watching) {
this.emit('end');
} else {
process.exit(1);
}
};
gulp.task('lint', function () {
return gulp.src(['gulpfile.js', 'lib/*.js', 'test/*.js'])
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('test', function () {
return gulp.src('test/*.js')
.pipe(mocha({
reporter: 'spec'
}))
.on('error', onError);
});
gulp.task('watch', function () {
watching = true;
gulp.watch(['lib/*.js', 'test/*.js'], function () {
gulp.run('lint', 'test');
});
});
gulp.task('default', ['watch']);