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 |
|
/** |
7 |
|
* provides access to the key libraries in istanbul so you can write |
8 |
|
* your own tools using `istanbul` as a library. |
9 |
|
* |
10 |
|
* @module istanbul |
11 |
|
*/ |
12 |
|
|
13 |
|
/*jslint nomen: true */ |
14 |
1 |
var path = require('path'), |
15 |
|
fs = require('fs'), |
16 |
|
Store = require('./lib/store'), |
17 |
|
Report = require('./lib/report'), |
18 |
|
meta = require('./lib/util/meta'); |
19 |
|
|
20 |
1 |
require('./lib/register-plugins'); |
21 |
|
|
22 |
|
/** |
23 |
|
* the top-level API for `istanbul`. |
24 |
|
* |
25 |
|
* Usage |
26 |
|
* ----- |
27 |
|
* |
28 |
|
* var istanbul = require('istanbul'); |
29 |
|
* |
30 |
|
* |
31 |
|
* @class API |
32 |
|
*/ |
33 |
|
|
34 |
1 |
module.exports = { |
35 |
|
/** |
36 |
|
* the Instrumenter class. |
37 |
|
* @property {Instrumenter} Instrumenter |
38 |
|
* @static |
39 |
|
*/ |
40 |
|
Instrumenter: require('./lib/instrumenter'), |
41 |
|
/** |
42 |
|
* the Store class. |
43 |
|
* @property {Store} Store |
44 |
|
* @static |
45 |
|
*/ |
46 |
|
Store: Store, |
47 |
|
/** |
48 |
|
* the Collector class |
49 |
|
* @property {Collector} Collector |
50 |
|
* @static |
51 |
|
*/ |
52 |
|
Collector: require('./lib/collector'), |
53 |
|
/** |
54 |
|
* the hook module |
55 |
|
* @property {Hook} hook |
56 |
|
* @static |
57 |
|
*/ |
58 |
|
hook: require('./lib/hook'), |
59 |
|
/** |
60 |
|
* the Report class |
61 |
|
* @property {Report} Report |
62 |
|
* @static |
63 |
|
*/ |
64 |
|
Report: Report, |
65 |
|
/** |
66 |
|
* utility for processing coverage objects |
67 |
|
* @property {ObjectUtils} utils |
68 |
|
* @static |
69 |
|
*/ |
70 |
|
utils: require('./lib/object-utils'), |
71 |
|
/** |
72 |
|
* asynchronously returns a function that can match filesystem paths. |
73 |
|
* The function returned in the callback may be passed directly as a `matcher` |
74 |
|
* to the functions in the `hook` module. |
75 |
|
* |
76 |
|
* When no options are passed, the match function is one that matches all JS |
77 |
|
* files under the current working directory except ones under `node_modules` |
78 |
|
* |
79 |
|
* Match patterns are `ant`-style patterns processed using the `fileset` library. |
80 |
|
* Examples not provided due to limitations in putting asterisks inside |
81 |
|
* jsdoc comments. Please refer to tests under `test/other/test-matcher.js` |
82 |
|
* for examples. |
83 |
|
* |
84 |
|
* @method matcherFor |
85 |
|
* @static |
86 |
|
* @param {Object} options Optional. Lookup options. |
87 |
|
* @param {String} [options.root] the root of the filesystem tree under |
88 |
|
* which to match files. Defaults to `process.cwd()` |
89 |
|
* @param {Array} [options.includes] an array of include patterns to match. |
90 |
|
* Defaults to all JS files under the root. |
91 |
|
* @param {Array} [options.excludes] and array of exclude patterns. File paths |
92 |
|
* matching these patterns will be excluded by the returned matcher. |
93 |
|
* Defaults to files under `node_modules` found anywhere under root. |
94 |
|
* @param {Function(err, matchFunction)} callback The callback that is |
95 |
|
* called with two arguments. The first is an `Error` object in case |
96 |
|
* of errors or a falsy value if there were no errors. The second |
97 |
|
* is a function that may be use as a matcher. |
98 |
|
*/ |
99 |
|
matcherFor: require('./lib/util/file-matcher').matcherFor, |
100 |
|
/** |
101 |
|
* the version of the library |
102 |
|
* @property {String} VERSION |
103 |
|
* @static |
104 |
|
*/ |
105 |
|
VERSION: meta.VERSION |
106 |
|
}; |
107 |
|
|
108 |
|
|
109 |
|
|