-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgulpfile.js
35 lines (31 loc) · 977 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
var gulp = require('gulp');
var guppy = require('./')(gulp);
var stylish = require('jshint-stylish');
var $ = require('gulp-load-plugins')();
gulp.task('test', ['lint', 'unit']);
gulp.task('unit', function (cb) {
gulp.src(['index.js', 'lib/*.js'])
.pipe($.istanbul())
.pipe($.istanbul.hookRequire())
.on('finish', function () {
gulp.src('test/guppy.tests.js', { read: false })
.pipe($.mocha())
.pipe($.istanbul.writeReports())
.on('end', cb);
});
});
gulp.task('lint', function () {
return gulp.src(['*.js', 'lib/*.js'])
.pipe($.filter(['*.js']))
.pipe($.jshint())
.pipe($.jshint.reporter(stylish))
.pipe($.jshint.reporter('fail'));
});
// run unit tests, then lint only the indexed changes
gulp.task('pre-commit', ['unit'], function () {
return guppy.stream('pre-commit')
.pipe($.filter(['*.js']))
.pipe($.jshint())
.pipe($.jshint.reporter(stylish))
.pipe($.jshint.reporter('fail'));
});