gulp plugin for coffee-coverage. Compiles CoffeeScript into Javascript with coverage logic.
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'));
});
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))
// ...
name | type | description |
---|---|---|
bare | Boolean | Do not wrap files in an anonymous function |
initfile | String | Generate an coverage initiation file |
initfile | Object Literal | Generate an coverage initiation file. Options are used to initialise the vinyl-fs file added to the stream |
instrumentor | String | Instrumentor to use with coffee-coverage. Either 'istanbul' or 'jscoverage' |
npm install --save-dev gulp-coffee-coverage