-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
32 lines (28 loc) · 943 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
var gulp = require('gulp');
var semver = require('semver');
gulp.task('lint', function() {
var eslint = require('gulp-eslint');
return gulp.src(['lib/tree-stringify.js', 'test/**/*.js', 'gulpfile.js'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('pre-test', function() {
var istanbul = require('gulp-istanbul');
return gulp.src('lib/tree-stringify.js')
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('test', ['pre-test'], function() {
var mocha = require('gulp-mocha');
var istanbul = require('gulp-istanbul');
return gulp.src('test/**/*.test.js', {read: false})
.pipe(mocha())
.pipe(istanbul.writeReports());
});
if (semver.satisfies(process.version, '>=4')) {
gulp.task('default', ['lint', 'test']);
} else {
// Don't lint in non-ES2015 environments
gulp.task('default', ['test']);
}