Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80680 views
1
var LcovOnly = require('./lcovonly'),
2
util = require('util');
3
4
/**
5
* a `Report` implementation that produces an LCOV coverage and prints it
6
* to standard out.
7
*
8
* Usage
9
* -----
10
*
11
* var report = require('istanbul').Report.create('text-lcov');
12
*
13
* @class TextLcov
14
* @module report
15
* @extends LcovOnly
16
* @constructor
17
* @param {Object} opts optional
18
* @param {String} [opts.log] the method used to log to console.
19
*/
20
function TextLcov(opts) {
21
var that = this;
22
23
LcovOnly.call(this);
24
25
this.opts = opts || {};
26
this.opts.log = this.opts.log || console.log;
27
this.opts.writer = {
28
println: function (ln) {
29
that.opts.log(ln);
30
}
31
};
32
}
33
34
TextLcov.TYPE = 'text-lcov';
35
util.inherits(TextLcov, LcovOnly);
36
37
LcovOnly.super_.mix(TextLcov, {
38
writeReport: function (collector) {
39
var that = this,
40
writer = this.opts.writer;
41
42
collector.files().forEach(function (key) {
43
that.writeFileCoverage(writer, collector.fileCoverageFor(key));
44
});
45
46
this.emit('done');
47
}
48
});
49
50
module.exports = TextLcov;
51
52