How to use the Report function from istanbul

Find comprehensive JavaScript istanbul.Report code examples handpicked from public code repositorys.

5
6
7
8
9
10
11
12
13
14
// Make sure istanbul is `require`d after the istanbul-threshold-checker to use the istanbul version
// defined in this package.json instead of the one defined in istanbul-threshold-checker.
var istanbul = require('istanbul');
var _ = require('lodash');
var applySourceMap = require('vinyl-sourcemaps-apply');
var Report = istanbul.Report;
var Collector = istanbul.Collector;
var PluginError = require('plugin-error');

var PLUGIN_NAME = 'gulp-istanbul';
fork icon87
star icon186
watch icon6

+ 9 other calls in file

131
132
133
134
135
136
137
138
139
140
  dir : outputDir,
  sourceStore : new BasePathStore({
    basePath : basePath
  })
});
var reporter = istanbul.Report.create(reporterConfig.type || 'html', options);
try {
  reporter.writeReport(collector, true);
} catch (e) {
  log.error(e);
fork icon255
star icon0
watch icon46

16
17
18
19
20
21
22
23
24
25
            collector = new istanbul.Collector();

        collector.add(cov);

        reporters.forEach(function(reporter) {
            istanbul.Report.create(reporter, reporterOpts).writeReport(collector, true);
        });

    });
};
fork icon15
star icon199
watch icon11

44
45
46
47
48
49
50
51
52
53
    return capsPromise;
},
onComplete: function () {
    browser.driver.executeScript('return __coverage__;').then(function (coverageResults) {
        collector.add(coverageResults);
        istanbul.Report
            .create('lcov', {
                dir: 'test/coverage/e2e'
            })
            .writeReport(collector, true);
fork icon9
star icon6
watch icon0

24
25
26
27
28
29
30
31
32
33
  }
});
Object.defineProperty(exports, 'Report', {
  enumerable: true,
  get: function get() {
    return _istanbul.Report;
  }
});
Object.defineProperty(exports, 'config', {
  enumerable: true,
fork icon1
star icon0
watch icon0

269
270
271
272
273
274
275
276
277
278
var options = helper.merge({
  sourceStore: sourceStore
}, config, reporterConfig, {
  dir: outputDir
})
var reporter = istanbul.Report.create(reporterConfig.type || 'html', options)

// If reporting to console, skip directory creation
var isConsole = reporterConfig.type && reporterConfig.type.match(/^(text|text-summary)$/)
var hasNoFile = _.isUndefined(reporterConfig.file)
fork icon0
star icon0
watch icon1

110
111
112
113
114
115
116
117
118
119
    res.statusCode = 404;
    return res.end('No coverage for file path [' + filePath + ']');
}

if(writer) {
    var report = istanbul.Report.create('html', {writer: writer, dir: rootpath + '/lcov-report'});
    writer.writeFile('coverage.json', function (w) {
        w.write(JSON.stringify(covObj, undefined, 4));
    });
    report.writeReport(collector, true);
fork icon0
star icon0
watch icon1

+ 3 other calls in file