-
Notifications
You must be signed in to change notification settings - Fork 60
/
Copy pathcovertasks.js
45 lines (39 loc) · 1.39 KB
/
covertasks.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
var gulp = require('gulp');
var del = require('del');
var jeditor = require("gulp-json-editor");
var istanbulReport = require('gulp-istanbul-report');
var cproc = require('child_process');
gulp.task('cover:clean', function (done) {
return del('coverage', done);
});
gulp.task('cover:enableconfig',() => {
return gulp.src("./coverconfig.json")
.pipe(jeditor(function(json) {
json.enabled = true;
return json; // must return JSON object.
}))
.pipe(gulp.dest("./out", {'overwrite':true}));
});
gulp.task('cover:enable', gulp.series('cover:clean', 'html:test', 'cover:enableconfig'));
gulp.task('cover:disable', () => {
return gulp.src("./coverconfig.json")
.pipe(jeditor(function(json) {
json.enabled = false;
return json; // must return JSON object.
}))
.pipe(gulp.dest("./out", {'overwrite':true}));
});
gulp.task('cover:combine', () => {
return gulp.src(['./coverage/coverage-final.json', './coverage/coverage-html.json'])
.pipe(istanbulReport({
reporterOpts: {
dir: './coverage'
},
reporters: [
{'name': 'lcovonly'}, // -> ./coverage/report.txt
{'name': 'cobertura'} // -> ./jsonCov/cov.json
]
}));
});
// for running on the jenkins build system
gulp.task('cover:jenkins', gulp.series('cover:clean', 'cover:enableconfig', 'html:test', 'ext:test', 'cover:combine'));