-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
54 lines (43 loc) · 1.17 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
51
52
53
54
'use strict';
var babel = require('gulp-babel');
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var mocha = require('gulp-spawn-mocha');
var sequence = require('gulp-sequence');
var shell = require('gulp-shell');
var src = [
'lib/**/*.js',
];
var test = [
'test/**/*.js',
];
var dest = 'build';
gulp.task('babel', function () {
return gulp.src(src)
.pipe(babel())
.pipe(gulp.dest(dest));
});
gulp.task('jshint', function () {
return gulp.src([].concat(src, test))
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('jshint-stylish'))
.pipe(jshint.reporter('fail'));
});
gulp.task('mocha', function () {
return gulp.src(test, {read: false})
.pipe(mocha());
});
gulp.task('coverage', shell.task(
'babel-node ./node_modules/isparta/bin/isparta cover --report text --report html --report lcov ./node_modules/mocha/bin/_mocha'
));
gulp.task('coveralls', ['coverage'], shell.task(
'node_modules/.bin/coveralls < coverage/lcov.info'
));
gulp.task('watch', function () {
gulp.watch([].concat(src, test), ['test']);
});
gulp.task('prepublish', ['babel']);
gulp.task('test', function (cb) {
sequence('mocha', 'jshint', cb);
});
gulp.task('default', ['watch']);