-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
45 lines (41 loc) · 1.25 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
const gulp = require('gulp');
const gulpTslint = require('gulp-tslint');
const tslint = require('tslint');
const through = require('through');
const gutil = require('gulp-util');
const PluginError = gutil.PluginError;
gulp.task('tslint-positive', function() {
return gulp.src('spec/*.pass.ts')
.pipe(gulpTslint({
configuration: './tslint.json',
formatter: 'verbose'
}))
.pipe(gulpTslint.report());
});
gulp.task('tslint-negative', function() {
return gulp.src('spec/*.fail.ts')
.pipe(gulpTslint({
configuration: `./tslint.json`,
formatter: 'verbose'
}))
.pipe((function() {
var hasError = false;
return through(function (file) {
if (file.tslint.failureCount === 0) {
gutil.log(
`[${gutil.colors.cyan('gulp-tslint')}]`,
gutil.colors.red(`error: ${file.tslint.failureCount}`),
`(negative) ${file.relative}`);
hasError = true;
}
}, function () {
if (hasError) {
this.emit('error', new PluginError('gulp-tslint', 'Failed negative test(s).'));
} else {
this.emit('end');
}
});
})());
});
gulp.task('tslint', ['tslint-positive', 'tslint-negative']);
gulp.task('default', ['tslint']);