1 |
|
/* |
2 |
|
Copyright (c) 2012, Yahoo! Inc. All rights reserved. |
3 |
|
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms. |
4 |
|
*/ |
5 |
|
|
6 |
|
/*jslint nomen: true */ |
7 |
1 |
var Factory = require('../util/factory'), |
8 |
|
factory = new Factory('report', __dirname, false); |
9 |
|
/** |
10 |
|
* abstract report class for producing coverage reports. |
11 |
|
* |
12 |
|
* Usage |
13 |
|
* ----- |
14 |
|
* |
15 |
|
* var Report = require('istanbul').Report, |
16 |
|
* report = Report.create('html'), |
17 |
|
* collector = new require('istanbul').Collector; |
18 |
|
* |
19 |
|
* collector.add(coverageObject); |
20 |
|
* report.writeReport(collector); |
21 |
|
* |
22 |
|
* @class Report |
23 |
|
* @constructor |
24 |
|
* @protected |
25 |
|
* @param {Object} options Optional. The options supported by a specific store implementation. |
26 |
|
*/ |
27 |
1 |
function Report(options) {} |
28 |
|
//add register, create, mix, loadAll, getStoreList as class methods |
29 |
1 |
factory.bindClassMethods(Report); |
30 |
|
|
31 |
|
/** |
32 |
|
* registers a new report implementation. |
33 |
|
* @method register |
34 |
|
* @static |
35 |
|
* @param {Function} constructor the constructor function for the report. This function must have a |
36 |
|
* `TYPE` property of type String, that will be used in `Report.create()` |
37 |
|
*/ |
38 |
|
/** |
39 |
|
* returns a report implementation of the specified type. |
40 |
|
* @method create |
41 |
|
* @static |
42 |
|
* @param {String} type the type of report to create |
43 |
|
* @param {Object} opts Optional. Options specific to the report implementation |
44 |
|
* @return {Report} a new store of the specified type |
45 |
|
*/ |
46 |
|
|
47 |
1 |
Report.prototype = { |
48 |
|
/** |
49 |
|
* writes the report for a set of coverage objects added to a collector. |
50 |
|
* @method writeReport |
51 |
|
* @param {Collector} collector the collector for getting the set of files and coverage |
52 |
|
* @param {Boolean} sync true if reports must be written synchronously, false if they can be written using asynchronous means (e.g. stream.write) |
53 |
|
*/ |
54 |
|
writeReport: function (collector, sync) { |
55 |
1 |
throw new Error('writeReport: must be overridden'); |
56 |
|
} |
57 |
|
}; |
58 |
|
|
59 |
1 |
module.exports = Report; |
60 |
|
|
61 |
|
|
62 |
|
|