gulp-istanbul

Istanbul unit test coverage plugin for gulp.

npm install gulp-istanbul
81 downloads in the last day
254 downloads in the last week
1 371 downloads in the last month

gulp-istanbul NPM version Build Status Dependency Status

Istanbul unit test coverage plugin for gulp.

Works on top of any Node.js unit test framework.

Installation

npm install --save-dev gulp-istanbul

Example

Then, add it to your gulpfile.js:

var istanbul = require("gulp-istanbul");

// Set up the file coverage
gulp.task('cover', function (cb) {
  gulp.src("lib/**/*.js")
    .pipe(istanbul())
    .on('end', cb);
});

// Run tests and output reports
gulp.task('test', function () {
  gulp.run('cover', function () {
    gulp.src('test/*.js')
      .pipe(mocha()) // Run any unit test frameworks here
      .pipe(istanbul.writeReports());
  });
});

API

istanbul()

Instrument files passes to the stream

istanbul.writeReports(dir)

Create the reports LCOV and json on stream end

dir

Type: String
Default: ./coverage

The folder in which the reports are to be outputted.

License

MIT License (c) Simon Boudrias - 2013

npm loves you