-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
83 lines (71 loc) · 1.65 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
'use strict';
var eslint = require('gulp-eslint');
var gulp = require('gulp');
var isparta = require('isparta');
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');
gulp.task('lint-test', function() {
return gulp.src([
'test/**/*.spec.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('lint-lib', function() {
return gulp.src([
'bin/juttle-service-client',
'bin/juttle-service',
'lib/**/*.js',
'gulpfile.js'
])
.pipe(eslint())
.pipe(eslint.format())
.pipe(eslint.failAfterError());
});
gulp.task('lint', ['lint-lib', 'lint-test']);
gulp.task('instrument', function () {
return gulp.src([
'lib/**/*.js'
])
.pipe(istanbul({
includeUntested: true,
// ES6 Instrumentation
instrumenter: isparta.Instrumenter
}))
.pipe(istanbul.hookRequire());
});
function gulp_test() {
var tests = [
'test/**/*.spec.js'
];
return gulp.src(tests)
.pipe(mocha({
log: true,
timeout: 30000,
reporter: 'spec',
ui: 'bdd',
ignoreLeaks: true,
globals: ['should']
}));
}
gulp.task('test', function() {
return gulp_test();
});
gulp.task('test-coverage', ['instrument'], function() {
var coverage;
coverage = {
global: {
statements: 84,
branches: 74,
functions: 81,
lines: 82
}
};
return gulp_test()
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({
thresholds: coverage
}));
});
gulp.task('default', ['test', 'lint']);