How to use the istanbul.Collector function in istanbul

To help you get started, we’ve selected a few istanbul examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitovi / testee / lib / server / hooks / coverage.js View on Github external
module.exports = function (server, coverageObject) {
	// TODO html-cov etc.
	var report = istanbul.Report.create('text');
	var collector = new istanbul.Collector();

	collector.add(coverageObject);
	report.writeReport(collector);
};
github bitovi / testee / lib / extensions / coverage.js View on Github external
var hook = exports.hook = function (server, coverageObject) {
	var config = server.config.coverage;
	if(config) {
		// TODO html-cov etc.
		var report = istanbul.Report.create('text');
		var collector = new istanbul.Collector();

		collector.add(coverageObject);
		report.writeReport(collector);
	}
};
github rschuft / karma-sharding / lib / reporter.js View on Github external
this.onBrowserStart = function (browser) {
    if (!collectors[browser[aggregator]]) { // ADDED BY KARMA-SHARDING
      collectors[browser[aggregator]] = new istanbul.Collector(); // CHANGE MADE BY KARMA-SHARDING

      if (!includeAllSources) return;

      collectors[browser[aggregator]].add(coverageMap.get()); // CHANGE MADE BY KARMA-SHARDING
    } // ADDED BY KARMA-SHARDING
  };
github t2ym / i18n-behavior / test / patched-web-component-tester-istanbul-0.10.0-plugin.js View on Github external
function Listener(emitter, pluginOptions) {

  this.options = pluginOptions;
  this.collector = new istanbul.Collector();
  this.reporter = new istanbul.Reporter(false, this.options.dir);
  this.validator = new Validator(this.options.thresholds);
  this.reporter.addAll(this.options.reporters)

  emitter.on('sub-suite-end', function(browser, data) {
    if (data && data.__coverage__) {
      this.collector.add(data.__coverage__);
    }
  }.bind(this));

  emitter.on('run-end', function(error) {
    if (!error) {
      this.reporter.write(this.collector, sync, function() {});

      if (!validator.validate(this.collector)) {
        throw new Error('Coverage failed');
github thedeeno / web-component-tester-istanbul / lib / plugin.js View on Github external
function Listener(emitter, pluginOptions) {

  this.options = pluginOptions;
  this.collector = new istanbul.Collector();
  this.reporter = new istanbul.Reporter(false, this.options.dir);
  this.validator = new Validator(this.options.thresholds);
  this.reporter.addAll(this.options.reporters)

  emitter.on('sub-suite-end', function(browser, data) {
    if (data.__coverage__) {
      this.collector.add(data.__coverage__);
    }
  }.bind(this));

  emitter.on('run-end', function(error) {
    if (!error) {
      this.reporter.write(this.collector, sync, function() {});

      if (!validator.validate(this.collector)) {
        throw new Error('Coverage failed');
github montagejs / mr / spec / phantom.js View on Github external
.then(function (coverage) {
            var reporter = istanbul.Report.create("lcov");
            var collector = new istanbul.Collector();

            collector.add(coverage);

            console.log("Writing coverage reports.");
            reporter.writeReport(collector);
        });
    })
github scimusmn / stele / scripts / istanbul-reporter.js View on Github external
runner.on('end', () => {
    const cov = global.__coverage__ || {};
    const collector = new istanbul.Collector();

    collector.add(cov);

    reporters.forEach((reporter) => {
      istanbul.Report.create(reporter, reporterOpts).writeReport(collector, true);
    });
  });
};
github aurelia / aurelia / scripts / combine-coverage.ts View on Github external
function combine(output: string): void {
  const collector = new istanbul.Collector();
  const coveragePaths = ['kernel', 'runtime', 'jit']
    .map(p => join(project.coverage.path, p, 'coverage-final.json'));

  for (const coveragePath of coveragePaths) {
    if (existsSync(coveragePath)) {
      const json = JSON.parse(readFileSync(coveragePath, 'utf8'));
      collector.add(json);
    }
  }
  istanbul.Report.create(output, opts).writeReport(collector);
}
github quilljs / quill / config / protractor.coverage.js View on Github external
config.onPrepare = _.wrap(config.onPrepare, function(onPrepare) {
  onPrepare();
  protractor.collector = new istanbul.Collector();
});
github yahoo / preceptor / lib / manager.js View on Github external
function (options) {
		this.__super();

		log4js.setGlobalLogLevel('INFO');
		this._options = options || {};

		this._taskDecoratorList = {};
		this._clientDecoratorList = {};
		this._taskList = {};

		this._reportManager = null;

		this._coverageCollector = new istanbul.Collector();

		this.initialize();
	},

istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests

BSD-3-Clause
Latest version published 8 years ago

Package Health Score

55 / 100
Full package analysis