-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathgulpfile.js
60 lines (52 loc) · 1.24 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
var gulp = require('gulp');
var isparta = require('isparta');
var istanbul = require('gulp-istanbul');
var mocha = require('gulp-mocha');
// required to run gulp-mocha on babel code
require('babel-core/register');
gulp.task('instrument', function () {
return gulp.src([
'src/**/*.js',
'!src/apps/index.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',
require: ['./test/setup.js'],
ui: 'bdd',
ignoreLeaks: true,
globals: ['should']
}));
}
gulp.task('test', function() {
return gulp_test();
});
gulp.task('test-coverage', ['instrument'], function() {
var coverage = {
global: {
statements: 87,
branches: 87,
functions: 85,
lines: 62
}
};
return gulp_test()
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({
thresholds: coverage
}));
});
gulp.task('default', ['test']);