-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
46 lines (42 loc) · 1.04 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
var gulp = require('gulp');
var istanbul = require('gulp-istanbul');
var jasmine = require('gulp-jasmine');
var isWatching = false;
gulp.task('instrument', function () {
return gulp.src(['lib/**/*.js'])
.pipe(istanbul())
.pipe(istanbul.hookRequire());
});
gulp.task('coverage', ['instrument'], function () {
var hasErrors = 0;
return gulp.src(['test/**/*.js'])
.pipe(jasmine({
verbose: false,
includeStackTrace: true
}))
.on('error', function (err) {
hasErrors++;
console.log(err);
this.emit('end');
})
.pipe(istanbul.writeReports())
.pipe(istanbul.enforceThresholds({thresholds: {global: 10}}))
.on('end', function () {
process.exit(hasErrors);
});
});
gulp.task('test', function () {
var hasErrors = 0;
return gulp.src(['test/**/*.js'])
.pipe(jasmine({
verbose: false,
includeStackTrace: true
}))
.on('error', function () {
hasErrors++;
this.emit('end');
}).
on('end', function () {
process.exit(hasErrors);
})
});