-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
50 lines (43 loc) · 1.31 KB
/
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
47
48
49
50
var babelTrans = require('babel-register');
var gulp = require('gulp');
var babel = require('gulp-babel');
var mocha = require('gulp-mocha');
var del = require('del');
var nodeVersion = require('node-version');
gulp.task('clean', function () {
return del('lib');
});
gulp.task('lint', function () {
// TODO: eslint supports node version 4 or higher.
// Remove this condition once we get rid of node 0.10 support.
if (nodeVersion.major === '0')
return null;
var eslint = require('gulp-eslint');
return gulp
.src([
'src/**/*.js',
'test/**/*.js',
'Gulpfile.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('build', ['clean', 'lint'], function () {
return gulp
.src('src/**/*.js')
.pipe(babel())
.pipe(gulp.dest('lib'));
});
gulp.task('test', ['build'], function () {
return gulp
.src('test/**.js')
.pipe(mocha({
compilers: {
js: babelTrans
},
ui: 'bdd',
reporter: 'spec',
timeout: typeof v8debug === 'undefined' ? 2000 : Infinity // NOTE: disable timeouts in debug
}));
});