forked from gotwarlost/istanbul
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
153 lines (147 loc) · 4.24 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
/*
Copyright (c) 2012, Yahoo! Inc. All rights reserved.
Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
/*jslint nomen: true */
var path = require('path'),
Store = require('./lib/store'),
Report = require('./lib/report'),
meta = require('./lib/util/meta');
//register our standard plugins
require('./lib/register-plugins');
/**
* the top-level API for `istanbul`. provides access to the key libraries in
* istanbul so you can write your own tools using `istanbul` as a library.
*
* Usage
* -----
*
* var istanbul = require('istanbul');
*
*
* @class Istanbul
* @static
* @module main
* @main main
*/
module.exports = {
/**
* the Instrumenter class.
* @property Instrumenter
* @type Instrumenter
* @static
*/
Instrumenter: require('./lib/instrumenter'),
/**
* the Store class.
* @property Store
* @type Store
* @static
*/
Store: Store,
/**
* the Collector class
* @property Collector
* @type Collector
* @static
*/
Collector: require('./lib/collector'),
/**
* the hook module
* @property hook
* @type Hook
* @static
*/
hook: require('./lib/hook'),
/**
* the Report class
* @property Report
* @type Report
* @static
*/
Report: Report,
/**
* the config module
* @property config
* @type Config
* @static
*/
config: require('./lib/config'),
/**
* the Reporter class
* @property Reporter
* @type Reporter
* @static
*/
Reporter: require('./lib/reporter'),
/**
* utility for processing coverage objects
* @property utils
* @type ObjectUtils
* @static
*/
utils: require('./lib/object-utils'),
/**
* asynchronously returns a function that can match filesystem paths.
* The function returned in the callback may be passed directly as a `matcher`
* to the functions in the `hook` module.
*
* When no options are passed, the match function is one that matches all JS
* files under the current working directory except ones under `node_modules`
*
* Match patterns are `ant`-style patterns processed using the `glob` library.
* Examples not provided due to limitations in putting asterisks inside
* jsdoc comments. Please refer to tests under `test/other/test-matcher.js`
* for examples.
*
* @method matcherFor
* @static
* @param {Object} options Optional. Lookup options.
* @param {String} [options.root] the root of the filesystem tree under
* which to match files. Defaults to `process.cwd()`
* @param {Array} [options.includes] an array of include patterns to match.
* Defaults to all JS files under the root.
* @param {Array} [options.excludes] and array of exclude patterns. File paths
* matching these patterns will be excluded by the returned matcher.
* Defaults to files under `node_modules` found anywhere under root.
* @param {Function(err, matchFunction)} callback The callback that is
* called with two arguments. The first is an `Error` object in case
* of errors or a falsy value if there were no errors. The second
* is a function that may be use as a matcher.
*/
matcherFor: require('./lib/util/file-matcher').matcherFor,
/**
* the version of the library
* @property VERSION
* @type String
* @static
*/
VERSION: meta.VERSION,
/**
* the abstract Writer class
* @property Writer
* @type Writer
* @static
*/
Writer: require('./lib/util/writer').Writer,
/**
* the abstract ContentWriter class
* @property ContentWriter
* @type ContentWriter
* @static
*/
ContentWriter: require('./lib/util/writer').ContentWriter,
/**
* the concrete FileWriter class
* @property FileWriter
* @type FileWriter
* @static
*/
FileWriter: require('./lib/util/file-writer'),
//undocumented
_yuiLoadHook: require('./lib/util/yui-load-hook'),
//undocumented
TreeSummarizer: require('./lib/util/tree-summarizer'),
//undocumented
assetsDir: path.resolve(__dirname, 'lib', 'assets')
};