-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
57 lines (51 loc) · 1.15 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
55
56
57
'use strict';
var eslint = require('gulp-eslint');
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');
gulp.task('lint', function() {
return gulp.src([
'gulpfile.js',
'test/**/*.js',
'lib/**/*.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('instrument', function () {
return gulp.src([
'lib/**/*.js',
])
.pipe(istanbul({
includeUntested: true
}))
.pipe(istanbul.hookRequire());
});
function gulp_test() {
return gulp.src('test/**/*.spec.js')
.pipe(mocha({
log: true,
timeout: 60000,
slow: 3000,
reporter: 'spec',
ui: 'bdd'
}));
}
gulp.task('test', function() {
return gulp_test();
});
gulp.task('test-coverage', ['instrument'], function() {
return gulp_test()
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({
thresholds: {
global: {
statements: 100,
branches: 100,
functions: 100,
lines: 100
}
}
}));
});