Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / istanbul / lib / report / index.js
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 var util = require('util'),
7     EventEmitter = require('events').EventEmitter,
8     Factory = require('../util/factory'),
9     factory = new Factory('report', __dirname, false);
10 /**
11  * An abstraction for producing coverage reports.
12  * This class is both the base class as well as a factory for `Report` implementations.
13  * All reports are event emitters and are expected to emit a `done` event when
14  * the report writing is complete.
15  *
16  * See also the `Reporter` class for easily producing multiple coverage reports
17  * with a single call.
18  *
19  * Usage
20  * -----
21  *
22  *      var Report = require('istanbul').Report,
23  *          report = Report.create('html'),
24  *          collector = new require('istanbul').Collector;
25  *
26  *      collector.add(coverageObject);
27  *      report.on('done', function () { console.log('done'); });
28  *      report.writeReport(collector);
29  *
30  * @class Report
31  * @module report
32  * @main report
33  * @constructor
34  * @protected
35  * @param {Object} options Optional. The options supported by a specific store implementation.
36  */
37 function Report(/* options */) {
38     EventEmitter.call(this);
39 }
40
41 util.inherits(Report, EventEmitter);
42
43 //add register, create, mix, loadAll, getReportList as class methods
44 factory.bindClassMethods(Report);
45
46 /**
47  * registers a new report implementation.
48  * @method register
49  * @static
50  * @param {Function} constructor the constructor function for the report. This function must have a
51  *  `TYPE` property of type String, that will be used in `Report.create()`
52  */
53 /**
54  * returns a report implementation of the specified type.
55  * @method create
56  * @static
57  * @param {String} type the type of report to create
58  * @param {Object} opts Optional. Options specific to the report implementation
59  * @return {Report} a new store of the specified type
60  */
61 /**
62  * returns the list of available reports as an array of strings
63  * @method getReportList
64  * @static
65  * @return an array of supported report formats
66  */
67
68 var proto = {
69     /**
70      * returns a one-line summary of the report
71      * @method synopsis
72      * @return {String} a description of what the report is about
73      */
74     synopsis: function () {
75         throw new Error('synopsis must be overridden');
76     },
77     /**
78      * returns a config object that has override-able keys settable via config
79      * @method getDefaultConfig
80      * @return {Object|null} an object representing keys that can be overridden via
81      *  the istanbul configuration where the values are the defaults used when
82      *  not specified. A null return implies no config attributes
83      */
84     getDefaultConfig: function () {
85         return null;
86     },
87     /**
88      * writes the report for a set of coverage objects added to a collector.
89      * @method writeReport
90      * @param {Collector} collector the collector for getting the set of files and coverage
91      * @param {Boolean} sync true if reports must be written synchronously, false if they can be written using asynchronous means (e.g. stream.write)
92      */
93     writeReport: function (/* collector, sync */) {
94         throw new Error('writeReport: must be overridden');
95     }
96 };
97
98 Object.keys(proto).forEach(function (k) {
99     Report.prototype[k] = proto[k];
100 });
101
102 module.exports = Report;
103
104