-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (44 loc) · 1.14 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
/*eslint no-invalid-this: 0*/
var
coveralls = require('gulp-coveralls'),
del = require('del'),
eslint = require('gulp-eslint'),
gulp = require('gulp'),
gulpUtil = require('gulp-util'),
istanbul = require('gulp-istanbul'),
mocha = require('gulp-mocha');
module.exports = (() => {
'use strict';
gulp.task('clean', () => (del('coverage', 'reports')));
gulp.task('coveralls', function () {
return gulp
.src('./reports/lcov.info')
.pipe(coveralls());
});
gulp.task('lint', () => {
return gulp
.src(['**/*.js', '!node_modules/**', '!reports/**'])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('test-all', ['clean', 'lint', 'test-unit']);
gulp.task('test-unit', ['clean'], () => {
return gulp
.src(['./lib/**/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire())
.on('finish', () => {
return gulp
.src(['./test/lib/**/*.js'])
.pipe(mocha({ reporter : 'spec' })
.on('error', function (err) {
if (err.showStack) {
gulpUtil.log(err);
}
this.emit('end');
}))
.pipe(istanbul.writeReports('./reports'))
});
});
})();