-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
39 lines (32 loc) · 858 Bytes
/
Copy pathgulpfile.js
File metadata and controls
39 lines (32 loc) · 858 Bytes
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
"use strict";
const gulp = require('gulp');
const jasmine = require('gulp-jasmine');
const istanbul = require('gulp-istanbul');
const SpecReporter = require('jasmine-spec-reporter');
let srcs = gulp.src('./index.js');
let all = gulp.src('./spec/*.js');
function buildCoverage() {
return srcs
.pipe(istanbul())
.pipe(istanbul.hookRequire());
}
function runSpecs() {
let spec;
let toJasmine = jasmine({
reporter: new SpecReporter({
displayStackTrace: 'summary'
})
});
spec = all.pipe(toJasmine)
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({
thresholds: {global: 50}
}));
return spec.on('end', function () {
process.exit(0);
}).on('error', function () {
process.exit(1);
});
}
gulp.task('buildCoverage', buildCoverage);
gulp.task('specs', ['buildCoverage'], runSpecs);