Skip to content

Commit cccde76

Browse files
committed
Changed gulp tasks to be module exports since gulp.task() is deprecated
1 parent 1a82665 commit cccde76

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

gulpfile.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,20 @@ var ts = require('gulp-typescript');
1111
var typescript = require('typescript');
1212
var tslint = require('gulp-tslint');
1313

14-
gulp.task('test.check-format', function() {
14+
function checkFormat() {
1515
return gulp.src(['*.js', 'lib/**/*.ts', 'test/**/*.ts'])
1616
.pipe(formatter.checkFormat('file', clangFormat))
1717
.on('warning', onError);
18-
});
18+
}
19+
exports['test.check-format'] = checkFormat;
1920

20-
gulp.task('test.check-lint', function() {
21+
function checkLint() {
2122
return gulp.src(['lib/**/*.ts', 'test/**/*.ts'])
2223
.pipe(tslint({formatter: 'verbose'}))
2324
.pipe(tslint.report())
2425
.on('warning', onError);
25-
});
26+
}
27+
exports['test.check-lint'] = checkLint;
2628

2729
var hasError;
2830
var failOnError = true;
@@ -65,7 +67,7 @@ gulp.task('test.compile', gulp.series('compile', function(done) {
6567
.pipe(gulp.dest('build/')); // '/test/' comes from base above.
6668
}));
6769

68-
gulp.task('test.unit', gulp.series('test.compile', function(done) {
70+
unitTests = gulp.series('test.compile', function(done) {
6971
if (hasError) {
7072
done();
7173
return;
@@ -74,11 +76,12 @@ gulp.task('test.unit', gulp.series('test.compile', function(done) {
7476
timeout: 4000, // Needed by the type-based tests :-(
7577
fullTrace: true,
7678
}));
77-
}));
79+
});
80+
exports['test.unit'] = unitTests;
7881

79-
gulp.task('test', gulp.series('test.check-format', 'test.check-lint', 'test.unit'));
82+
gulp.task('test', gulp.series(checkFormat, checkLint, unitTests));
8083

81-
gulp.task('watch', gulp.series('test.unit', function() {
84+
gulp.task('watch', gulp.series(unitTests, function() {
8285
failOnError = false;
8386
// Avoid watching generated .d.ts in the build (aka output) directory.
8487
return gulp.watch(['lib/**/*.ts', 'test/**/*.ts'], {ignoreInitial: true}, ['test.unit']);

0 commit comments

Comments
 (0)