1.0.0 • Published 8 years ago

gulp-coffee-coverage v1.0.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
8 years ago

gulp-coffee-coverage

gulp plugin for coffee-coverage. Compiles CoffeeScript into Javascript with coverage logic.

Build Status Coverage Status

Usage

var coverage = require('../');

gulp.task('coffee-coverage', function() {
    return gulp.src('src/*.coffee')
    .pipe(coverage({ bare: true }).on('error', gutil.log))
    .pipe(gulp.dest('dist'));
});

Error handling

gulp-coffee-coverage will emit an error for cases such as invalid coffeescript syntax. If uncaught, the error will crash gulp.

You will need to attach a listener (i.e. .on('error')) for the error event emitted by gulp-coffee-coverage:

var coverageStream = coverage({bare: true});

// Attach listener
coverageStream.on('error', function(err) {});

In addition, you may utilize gulp-util's logging function:

var gutil = require('gulp-util');

// ...

var coverageStream = coverage({bare: true});

// Attach listener
coverageStream.on('error', gutil.log);

Since .on(...) returns this, you can compact it as inline code:

gulp.src('./src/*.coffee')
  .pipe(coverage({bare: true}).on('error', gutil.log))
  // ...

Options

nametypedescription
bareBooleanDo not wrap files in an anonymous function
initfileStringGenerate an coverage initiation file
initfileObject LiteralGenerate an coverage initiation file. Options are used to initialise the vinyl-fs file added to the stream
instrumentorStringInstrumentor to use with coffee-coverage. Either 'istanbul' or 'jscoverage'

Installation

npm install --save-dev gulp-coffee-coverage