var gulp = require('gulp'),
    tsc = require('gulp-tsc'),
    tape = require('gulp-tape'),
    tapSpec = require('tap-spec'),
    del = require('del'),
    runSequence = require('run-sequence'),
    istanbul = require('gulp-istanbul');

gulp.task("test:clean", function(done) {
  del(['build-test/**']).then(function(paths) {
    console.log("=====\nDeleted the following files:\n" + paths.join('\n')+ "\n=====");
    done();
  });
});

gulp.task("test:build", function (done) {
  gulp.src('test/**/*.ts')
    .pipe(tsc())
    .pipe(gulp.dest('build-test/'))
    .on('end', done);
});

gulp.task("test:istanbul-hook", function () {
  return gulp.src('build-test/src/**/*.js')
    .pipe(istanbul())
    .pipe(istanbul.hookRequire());
});

gulp.task("test:run", function (done) {
  gulp.src('build-test/test/**/*.test.js')
    .pipe(tape({
      reporter: tapSpec()
    }))
    .pipe(istanbul.writeReports())
    .on('end', done);
});

gulp.task("test", function (done) {
  runSequence('test:clean', 'test:build', 'test:istanbul-hook', 'test:run', done);
});

var gulp = require('gulp'),
    tsc = require('gulp-tsc'),
    tape = require('gulp-tape'),
    tapSpec = require('tap-spec'),
    del = require('del'),
    runSequence = require('run-sequence'),
    istanbul = require('gulp-istanbul');

gulp.task("test:clean", function(done) {
  del(['build-test/**']).then(function(paths) {
    console.log("=====\nDeleted the following files:\n" + paths.join('\n')+ "\n=====");
    done();
  });
});

gulp.task("test:build", function (done) {
  gulp.src('test/**/*.ts')
    .pipe(tsc())
    .pipe(gulp.dest('build-test/'))
    .on('end', done);
});

gulp.task("test:istanbul-hook", function () {
  return gulp.src('build-test/src/**/*.js')
    .pipe(istanbul())
    .pipe(istanbul.hookRequire());
});

gulp.task("test:run", function (done) {
  gulp.src('build-test/test/**/*.test.js')
    .pipe(tape({
      reporter: tapSpec()
    }))
    .pipe(istanbul.writeReports({
      reporters: [ 'lcov', 'json', 'text-summary' ]
    }))
    .on('end', done);
});

gulp.task("test", function (done) {
  runSequence('test:clean', 'test:build', 'test:istanbul-hook', 'test:run', done);
});

Use coverage summary rather than full coverage breakdown
Use coverage summary rather than full coverage breakdown
