Giter VIP home page Giter VIP logo

gulp-istanbul-report's Introduction

gulp-istanbul-report

gulp plugin to create istanbul reports from pre-collected coverage files.

This gulp plugin creates reports using Istanbul from a stream of JSON coverage files (such as those generated by mocha-phantomjs-istanbul).

While gulp-istanbul works well for the basic scenario, operating directly on coverage files provides some flexibility that can come in handy when coverage information is collected elsewhere (e.g. in a browser).

Build Status

Installation

$ npm install gulp-istanbul-report --save-dev

Usage

Here's an example using it together with mocha-phantomjs-istanbul:

var mochaPhantomJS = require('gulp-mocha-phantomjs');
var istanbulReport = require('gulp-istanbul-report');

var coverageFile = './coverage/coverage.json';
var mochaPhantomOpts = {
  phantomjs: {
    hooks: 'mocha-phantomjs-istanbul',
    coverageFile: coverageFile 
  },
};

gulp.task('test', function () {
  gulp.src('test-runner.html', {read: false})
    .pipe(mochaPhantomJS(mochaPhantomOpts))
    .on('finish', function() {
      gulp.src(coverageFile)
        .pipe(istanbulReport())
    });
});

istanbulReport([options])

options.reporters

A list of reporters to use. See require('istanbul').Report.getReportList().

You can specify either just a name of the reporter as string, or an object with the name specified in name, where the other fields are treated as options for the reporter. Example:

istanbulReport({
  reporters: [
    'text-summary', // outputs summary to stdout, uses default options 
    {name: 'text', file: 'full.txt'} // writes full report to file
  ]
})

options.dir

The directory that reports should be written to. Will be applied to all reporters that don't explicitly override it.

options.reporterOpts

Default options to be applied to reporters who don't explicitly override them.

istanbulReport({
  reporterOpts: {
    dir: './coverage'
  },
  reporters: [
    {'name': 'text', file: 'report.txt'}, // -> ./coverage/report.txt
    {'name': 'json', file: 'cov.json', dir: './jsonCov'} // -> ./jsonCov/cov.json
  ]
})

License

MIT License

gulp-istanbul-report's People

Contributors

willembult avatar

Watchers

James Cloos avatar Luis Vargas avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.