monocart-coverage-reports 2.5.9 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +791 -778
- package/lib/cli.js +250 -215
- package/lib/converter/ast-visitor.js +675 -666
- package/lib/converter/ast.js +353 -353
- package/lib/converter/collect-source-maps.js +201 -201
- package/lib/converter/converter.js +1487 -1429
- package/lib/converter/find-original-range.js +737 -737
- package/lib/converter/ignore.js +163 -163
- package/lib/converter/info-branch.js +93 -93
- package/lib/converter/info-function.js +63 -63
- package/lib/converter/info-statement.js +43 -43
- package/lib/default/options.js +84 -84
- package/lib/default/template.html +47 -47
- package/lib/generate.js +720 -532
- package/lib/index.d.ts +360 -324
- package/lib/index.js +187 -180
- package/lib/index.mjs +5 -3
- package/lib/istanbul/istanbul-summary.js +70 -63
- package/lib/istanbul/istanbul.js +146 -146
- package/lib/packages/monocart-coverage-v8.js +1 -1
- package/lib/platform/concurrency.js +74 -74
- package/lib/platform/share.js +484 -484
- package/lib/utils/dedupe.js +118 -118
- package/lib/utils/request.js +62 -62
- package/lib/utils/snapshot.js +381 -0
- package/lib/utils/source-path.js +179 -179
- package/lib/utils/util.js +526 -526
- package/lib/v8/v8-summary.js +138 -138
- package/lib/v8/v8.js +400 -630
- package/package.json +81 -80
package/lib/index.d.ts
CHANGED
|
@@ -1,324 +1,360 @@
|
|
|
1
|
-
declare namespace MCR {
|
|
2
|
-
|
|
3
|
-
export interface V8CoverageEntry {
|
|
4
|
-
url: string;
|
|
5
|
-
/** css only */
|
|
6
|
-
text?: string;
|
|
7
|
-
/** css only */
|
|
8
|
-
ranges?: any[];
|
|
9
|
-
/** js only */
|
|
10
|
-
scriptId?: string;
|
|
11
|
-
/** js only */
|
|
12
|
-
source?: string;
|
|
13
|
-
/** js only */
|
|
14
|
-
functions?: any[];
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export type Watermarks = [number, number] | {
|
|
18
|
-
/** V8 only */
|
|
19
|
-
bytes?: [number, number];
|
|
20
|
-
statements
|
|
21
|
-
branches?: [number, number];
|
|
22
|
-
functions?: [number, number];
|
|
23
|
-
lines?: [number, number];
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export type ReportDescription =
|
|
27
|
-
['v8'] | ["v8", {
|
|
28
|
-
outputFile?: string;
|
|
29
|
-
inline?: boolean;
|
|
30
|
-
assetsPath?: string;
|
|
31
|
-
metrics?: Array<"bytes" | "statements" | "branches" | "functions" | "lines">;
|
|
32
|
-
}] |
|
|
33
|
-
['v8-json'] | ["v8-json", {
|
|
34
|
-
outputFile?: string;
|
|
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
|
-
metrics?: Array<"bytes" | "statements" | "branches" | "functions" | "lines">;
|
|
98
|
-
}] |
|
|
99
|
-
['raw'] | ['raw', {
|
|
100
|
-
outputDir?: string;
|
|
101
|
-
}] |
|
|
102
|
-
[string] | [string, {
|
|
103
|
-
type?: "v8" | "istanbul" | "both";
|
|
104
|
-
[key: string]: any;
|
|
105
|
-
}];
|
|
106
|
-
|
|
107
|
-
export type AddedResults = {
|
|
108
|
-
id: string;
|
|
109
|
-
path: string;
|
|
110
|
-
type: "v8" | "istanbul";
|
|
111
|
-
data: any;
|
|
112
|
-
} | undefined;
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
export interface MetricsSummary {
|
|
116
|
-
covered: number;
|
|
117
|
-
uncovered?: number;
|
|
118
|
-
total: number;
|
|
119
|
-
pct: number | "";
|
|
120
|
-
status: "low" | "medium" | "high" | "unknown";
|
|
121
|
-
/** V8 lines only */
|
|
122
|
-
blank?: number;
|
|
123
|
-
/** V8 lines only */
|
|
124
|
-
comment?: number;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export interface CoverageSummary {
|
|
128
|
-
/** V8 only */
|
|
129
|
-
bytes?: MetricsSummary;
|
|
130
|
-
statements
|
|
131
|
-
branches: MetricsSummary;
|
|
132
|
-
functions: MetricsSummary;
|
|
133
|
-
lines: MetricsSummary;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
/** V8 only */
|
|
137
|
-
export interface CoverageRange {
|
|
138
|
-
start: number;
|
|
139
|
-
end: number;
|
|
140
|
-
count: number;
|
|
141
|
-
ignored?: boolean;
|
|
142
|
-
none?: boolean;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
export interface IgnoredRange {
|
|
146
|
-
start: number;
|
|
147
|
-
end: number;
|
|
148
|
-
type: string;
|
|
149
|
-
n?: number;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
export interface CoverageFile {
|
|
153
|
-
sourcePath: string;
|
|
154
|
-
summary: CoverageSummary;
|
|
155
|
-
/** V8 only */
|
|
156
|
-
url?: string;
|
|
157
|
-
/** V8 only */
|
|
158
|
-
id?: string;
|
|
159
|
-
/** V8 only */
|
|
160
|
-
type?: string;
|
|
161
|
-
/** V8 only */
|
|
162
|
-
source?: string;
|
|
163
|
-
/** V8 only */
|
|
164
|
-
distFile?: string;
|
|
165
|
-
/** V8 only */
|
|
166
|
-
js?: boolean;
|
|
167
|
-
/** V8 only */
|
|
168
|
-
data?: {
|
|
169
|
-
bytes: CoverageRange[];
|
|
170
|
-
statements: CoverageRange[];
|
|
171
|
-
branches: CoverageRange[];
|
|
172
|
-
functions: CoverageRange[];
|
|
173
|
-
ignores?: IgnoredRange[];
|
|
174
|
-
/** codecov json format */
|
|
175
|
-
lines: {
|
|
176
|
-
[key: string]: number | string
|
|
177
|
-
};
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
export type CoverageResults = {
|
|
182
|
-
type: "v8" | "istanbul";
|
|
183
|
-
reportPath: string;
|
|
184
|
-
name: string;
|
|
185
|
-
watermarks: Watermarks;
|
|
186
|
-
summary: CoverageSummary;
|
|
187
|
-
files: CoverageFile[];
|
|
188
|
-
} | undefined;
|
|
189
|
-
|
|
190
|
-
export interface CoverageReportOptions {
|
|
191
|
-
|
|
192
|
-
/** {string} logging levels: off, error, info, debug */
|
|
193
|
-
logging?: string;
|
|
194
|
-
|
|
195
|
-
/** {string} output dir */
|
|
196
|
-
outputDir?: string;
|
|
197
|
-
|
|
198
|
-
/** {string|string[]} input raw dir(s) */
|
|
199
|
-
inputDir?: string | string[];
|
|
200
|
-
|
|
201
|
-
/**
|
|
202
|
-
*
|
|
203
|
-
* {string} 'v8', 'v8,console-details'
|
|
204
|
-
*
|
|
205
|
-
* {array} ['v8'], ['v8', ['console-details', { skipPercent: 80 }]]
|
|
206
|
-
*
|
|
207
|
-
* By default, `v8` for V8 data, `html` for Istanbul data
|
|
208
|
-
*/
|
|
209
|
-
reports?: string | ReportDescription[];
|
|
210
|
-
|
|
211
|
-
/** {string} Report name. Defaults to "Coverage Report". */
|
|
212
|
-
name?: string;
|
|
213
|
-
|
|
214
|
-
/** (V8 only) {string} Output [sub dir/]filename. Defaults to "index.html" */
|
|
215
|
-
outputFile?: string;
|
|
216
|
-
/** (V8 only) {boolean} Inline all scripts to the single HTML file. Defaults to false. */
|
|
217
|
-
inline?: boolean;
|
|
218
|
-
/** (V8 only) {string} Assets path if not inline. Defaults to "./assets" */
|
|
219
|
-
assetsPath?: string;
|
|
220
|
-
|
|
221
|
-
/** (V8 only)
|
|
222
|
-
*
|
|
223
|
-
* {string} `minimatch` pattern for entry url; {object} multiple patterns;
|
|
224
|
-
*
|
|
225
|
-
* {function} A filter function for each entry file in the V8 list.
|
|
226
|
-
* */
|
|
227
|
-
entryFilter?: string | {
|
|
228
|
-
[pattern: string]: boolean;
|
|
229
|
-
} | ((entry: V8CoverageEntry) => boolean);
|
|
230
|
-
|
|
231
|
-
/** (V8 only)
|
|
232
|
-
*
|
|
233
|
-
* {string} `minimatch` pattern for source path; {object} multiple patterns;
|
|
234
|
-
*
|
|
235
|
-
* {function} A filter function for each source path when the source is unpacked from the source map.
|
|
236
|
-
* */
|
|
237
|
-
sourceFilter?: string | {
|
|
238
|
-
[pattern: string]: boolean;
|
|
239
|
-
} | ((sourcePath: string) => boolean);
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* options for adding empty coverage for all files
|
|
243
|
-
*/
|
|
244
|
-
all?: string | string[] | {
|
|
245
|
-
/** the dir(s) of all files */
|
|
246
|
-
dir: string | string[];
|
|
247
|
-
/** the coverage data type, v8 or istanbul */
|
|
248
|
-
type?: "v8" | "istanbul";
|
|
249
|
-
/**
|
|
250
|
-
* the file filter, return the file type, if true, defaults to css if ".css" otherwise is js
|
|
251
|
-
*
|
|
252
|
-
* {string} `minimatch` pattern for file path; {object} multiple patterns; {function} A filter function for file path;
|
|
253
|
-
*/
|
|
254
|
-
filter?: string | {
|
|
255
|
-
[pattern: string]: "js" | "css" | boolean;
|
|
256
|
-
} | ((filePath: string) => "js" | "css" | boolean)
|
|
257
|
-
};
|
|
258
|
-
|
|
259
|
-
/** (V8 only) {boolean} Enable/Disable ignoring uncovered codes with the special comments: v8 ignore next/next N/start/stop */
|
|
260
|
-
v8Ignore?: boolean;
|
|
261
|
-
|
|
262
|
-
/** (Istanbul only) defaultSummarizer, sourceFinder */
|
|
263
|
-
|
|
264
|
-
/** {boolean} Generate lcov.info file, same as lcovonly report. Defaults to false. */
|
|
265
|
-
lcov?: boolean;
|
|
266
|
-
|
|
267
|
-
/**
|
|
268
|
-
* {function} Source path handler.
|
|
269
|
-
*
|
|
270
|
-
* {object} Replace key with value.
|
|
271
|
-
* */
|
|
272
|
-
sourcePath?: ((filePath: string) => string) | {
|
|
273
|
-
[key: string]: string;
|
|
274
|
-
};
|
|
275
|
-
|
|
276
|
-
/** {string|function} Specify the report path, especially when there are multiple reports. Defaults to outputDir/index.html. */
|
|
277
|
-
reportPath?: string | (() => string);
|
|
278
|
-
|
|
279
|
-
/** {array} watermarks for low/medium/high. Defaults to [50, 80]
|
|
280
|
-
* {object} { bytes:[50,80], statements:[50,80], branches:[50,80], functions:[50,80], lines:[50,80] } */
|
|
281
|
-
watermarks?: Watermarks;
|
|
282
|
-
|
|
283
|
-
/** {boolean} Indicates whether to clean previous files in output dir before generating report. Defaults to true. */
|
|
284
|
-
clean?: boolean;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* {boolean} Indicates whether to clean previous cache in output dir before generating report. Defaults to false.
|
|
288
|
-
*
|
|
289
|
-
* If true, the API `cleanCache()` will execute automatically.
|
|
290
|
-
*/
|
|
291
|
-
cleanCache?: boolean;
|
|
292
|
-
|
|
293
|
-
/** {function} onEnd hook */
|
|
294
|
-
onEnd?: (
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
export
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
/**
|
|
316
|
-
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
1
|
+
declare namespace MCR {
|
|
2
|
+
|
|
3
|
+
export interface V8CoverageEntry {
|
|
4
|
+
url: string;
|
|
5
|
+
/** css only */
|
|
6
|
+
text?: string;
|
|
7
|
+
/** css only */
|
|
8
|
+
ranges?: any[];
|
|
9
|
+
/** js only */
|
|
10
|
+
scriptId?: string;
|
|
11
|
+
/** js only */
|
|
12
|
+
source?: string;
|
|
13
|
+
/** js only */
|
|
14
|
+
functions?: any[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export type Watermarks = [number, number] | {
|
|
18
|
+
/** V8 only */
|
|
19
|
+
bytes?: [number, number];
|
|
20
|
+
statements: [number, number];
|
|
21
|
+
branches?: [number, number];
|
|
22
|
+
functions?: [number, number];
|
|
23
|
+
lines?: [number, number];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export type ReportDescription =
|
|
27
|
+
['v8'] | ["v8", {
|
|
28
|
+
outputFile?: string;
|
|
29
|
+
inline?: boolean;
|
|
30
|
+
assetsPath?: string;
|
|
31
|
+
metrics?: Array<"bytes" | "statements" | "branches" | "functions" | "lines">;
|
|
32
|
+
}] |
|
|
33
|
+
['v8-json'] | ["v8-json", {
|
|
34
|
+
outputFile?: string;
|
|
35
|
+
}] |
|
|
36
|
+
['clover'] | ['clover', {
|
|
37
|
+
file?: string;
|
|
38
|
+
}] |
|
|
39
|
+
['cobertura'] | ['cobertura', {
|
|
40
|
+
file?: string;
|
|
41
|
+
timestamp?: string;
|
|
42
|
+
projectRoot?: string;
|
|
43
|
+
}] |
|
|
44
|
+
['html'] | ['html', {
|
|
45
|
+
subdir?: string;
|
|
46
|
+
verbose?: boolean;
|
|
47
|
+
linkMapper?: any;
|
|
48
|
+
skipEmpty?: boolean;
|
|
49
|
+
}] |
|
|
50
|
+
['html-spa'] | ['html-spa', {
|
|
51
|
+
subdir?: string;
|
|
52
|
+
verbose?: boolean;
|
|
53
|
+
linkMapper?: any;
|
|
54
|
+
skipEmpty?: boolean;
|
|
55
|
+
metricsToShow?: Array<"statements" | "branches" | "functions" | "lines">;
|
|
56
|
+
}] |
|
|
57
|
+
['json'] | ['json', {
|
|
58
|
+
file?: string;
|
|
59
|
+
}] |
|
|
60
|
+
['json-summary'] | ['json-summary', {
|
|
61
|
+
file?: string;
|
|
62
|
+
}] |
|
|
63
|
+
['lcov'] | ['lcov', {
|
|
64
|
+
file?: string;
|
|
65
|
+
projectRoot?: string;
|
|
66
|
+
}] |
|
|
67
|
+
['lcovonly'] | ['lcovonly', {
|
|
68
|
+
file?: string;
|
|
69
|
+
projectRoot?: string;
|
|
70
|
+
}] |
|
|
71
|
+
['none'] |
|
|
72
|
+
['teamcity'] | ['teamcity', {
|
|
73
|
+
file?: string;
|
|
74
|
+
blockName?: string;
|
|
75
|
+
}] |
|
|
76
|
+
['text'] | ['text', {
|
|
77
|
+
file?: string;
|
|
78
|
+
maxCols?: number;
|
|
79
|
+
skipEmpty?: boolean;
|
|
80
|
+
skipFull?: boolean;
|
|
81
|
+
}] |
|
|
82
|
+
['text-lcov'] | ['text-lcov', {
|
|
83
|
+
projectRoot?: string;
|
|
84
|
+
}] |
|
|
85
|
+
['text-summary'] | ['text-summary', {
|
|
86
|
+
file?: string;
|
|
87
|
+
}] |
|
|
88
|
+
['codecov'] | ["codecov", {
|
|
89
|
+
outputFile?: string;
|
|
90
|
+
}] |
|
|
91
|
+
['console-summary'] | ['console-summary', {
|
|
92
|
+
metrics?: Array<"bytes" | "statements" | "branches" | "functions" | "lines">;
|
|
93
|
+
}] |
|
|
94
|
+
['console-details'] | ['console-details', {
|
|
95
|
+
maxCols?: number;
|
|
96
|
+
skipPercent?: number;
|
|
97
|
+
metrics?: Array<"bytes" | "statements" | "branches" | "functions" | "lines">;
|
|
98
|
+
}] |
|
|
99
|
+
['raw'] | ['raw', {
|
|
100
|
+
outputDir?: string;
|
|
101
|
+
}] |
|
|
102
|
+
[string] | [string, {
|
|
103
|
+
type?: "v8" | "istanbul" | "both";
|
|
104
|
+
[key: string]: any;
|
|
105
|
+
}];
|
|
106
|
+
|
|
107
|
+
export type AddedResults = {
|
|
108
|
+
id: string;
|
|
109
|
+
path: string;
|
|
110
|
+
type: "v8" | "istanbul";
|
|
111
|
+
data: any;
|
|
112
|
+
} | undefined;
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
export interface MetricsSummary {
|
|
116
|
+
covered: number;
|
|
117
|
+
uncovered?: number;
|
|
118
|
+
total: number;
|
|
119
|
+
pct: number | "";
|
|
120
|
+
status: "low" | "medium" | "high" | "unknown";
|
|
121
|
+
/** V8 lines only */
|
|
122
|
+
blank?: number;
|
|
123
|
+
/** V8 lines only */
|
|
124
|
+
comment?: number;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface CoverageSummary {
|
|
128
|
+
/** V8 only */
|
|
129
|
+
bytes?: MetricsSummary;
|
|
130
|
+
statements: MetricsSummary;
|
|
131
|
+
branches: MetricsSummary;
|
|
132
|
+
functions: MetricsSummary;
|
|
133
|
+
lines: MetricsSummary;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
/** V8 only */
|
|
137
|
+
export interface CoverageRange {
|
|
138
|
+
start: number;
|
|
139
|
+
end: number;
|
|
140
|
+
count: number;
|
|
141
|
+
ignored?: boolean;
|
|
142
|
+
none?: boolean;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface IgnoredRange {
|
|
146
|
+
start: number;
|
|
147
|
+
end: number;
|
|
148
|
+
type: string;
|
|
149
|
+
n?: number;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export interface CoverageFile {
|
|
153
|
+
sourcePath: string;
|
|
154
|
+
summary: CoverageSummary;
|
|
155
|
+
/** V8 only */
|
|
156
|
+
url?: string;
|
|
157
|
+
/** V8 only */
|
|
158
|
+
id?: string;
|
|
159
|
+
/** V8 only */
|
|
160
|
+
type?: string;
|
|
161
|
+
/** V8 only */
|
|
162
|
+
source?: string;
|
|
163
|
+
/** V8 only */
|
|
164
|
+
distFile?: string;
|
|
165
|
+
/** V8 only */
|
|
166
|
+
js?: boolean;
|
|
167
|
+
/** V8 only */
|
|
168
|
+
data?: {
|
|
169
|
+
bytes: CoverageRange[];
|
|
170
|
+
statements: CoverageRange[];
|
|
171
|
+
branches: CoverageRange[];
|
|
172
|
+
functions: CoverageRange[];
|
|
173
|
+
ignores?: IgnoredRange[];
|
|
174
|
+
/** codecov json format */
|
|
175
|
+
lines: {
|
|
176
|
+
[key: string]: number | string
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type CoverageResults = {
|
|
182
|
+
type: "v8" | "istanbul";
|
|
183
|
+
reportPath: string;
|
|
184
|
+
name: string;
|
|
185
|
+
watermarks: Watermarks;
|
|
186
|
+
summary: CoverageSummary;
|
|
187
|
+
files: CoverageFile[];
|
|
188
|
+
} | undefined;
|
|
189
|
+
|
|
190
|
+
export interface CoverageReportOptions {
|
|
191
|
+
|
|
192
|
+
/** {string} logging levels: off, error, info, debug */
|
|
193
|
+
logging?: string;
|
|
194
|
+
|
|
195
|
+
/** {string} output dir */
|
|
196
|
+
outputDir?: string;
|
|
197
|
+
|
|
198
|
+
/** {string|string[]} input raw dir(s) */
|
|
199
|
+
inputDir?: string | string[];
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
*
|
|
203
|
+
* {string} 'v8', 'v8,console-details'
|
|
204
|
+
*
|
|
205
|
+
* {array} ['v8'], ['v8', ['console-details', { skipPercent: 80 }]]
|
|
206
|
+
*
|
|
207
|
+
* By default, `v8` for V8 data, `html` for Istanbul data
|
|
208
|
+
*/
|
|
209
|
+
reports?: string | ReportDescription[];
|
|
210
|
+
|
|
211
|
+
/** {string} Report name. Defaults to "Coverage Report". */
|
|
212
|
+
name?: string;
|
|
213
|
+
|
|
214
|
+
/** (V8 only) {string} Output [sub dir/]filename. Defaults to "index.html" */
|
|
215
|
+
outputFile?: string;
|
|
216
|
+
/** (V8 only) {boolean} Inline all scripts to the single HTML file. Defaults to false. */
|
|
217
|
+
inline?: boolean;
|
|
218
|
+
/** (V8 only) {string} Assets path if not inline. Defaults to "./assets" */
|
|
219
|
+
assetsPath?: string;
|
|
220
|
+
|
|
221
|
+
/** (V8 only)
|
|
222
|
+
*
|
|
223
|
+
* {string} `minimatch` pattern for entry url; {object} multiple patterns;
|
|
224
|
+
*
|
|
225
|
+
* {function} A filter function for each entry file in the V8 list.
|
|
226
|
+
* */
|
|
227
|
+
entryFilter?: string | {
|
|
228
|
+
[pattern: string]: boolean;
|
|
229
|
+
} | ((entry: V8CoverageEntry) => boolean);
|
|
230
|
+
|
|
231
|
+
/** (V8 only)
|
|
232
|
+
*
|
|
233
|
+
* {string} `minimatch` pattern for source path; {object} multiple patterns;
|
|
234
|
+
*
|
|
235
|
+
* {function} A filter function for each source path when the source is unpacked from the source map.
|
|
236
|
+
* */
|
|
237
|
+
sourceFilter?: string | {
|
|
238
|
+
[pattern: string]: boolean;
|
|
239
|
+
} | ((sourcePath: string) => boolean);
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* options for adding empty coverage for all files
|
|
243
|
+
*/
|
|
244
|
+
all?: string | string[] | {
|
|
245
|
+
/** the dir(s) of all files */
|
|
246
|
+
dir: string | string[];
|
|
247
|
+
/** the coverage data type, v8 or istanbul */
|
|
248
|
+
type?: "v8" | "istanbul";
|
|
249
|
+
/**
|
|
250
|
+
* the file filter, return the file type, if true, defaults to css if ".css" otherwise is js
|
|
251
|
+
*
|
|
252
|
+
* {string} `minimatch` pattern for file path; {object} multiple patterns; {function} A filter function for file path;
|
|
253
|
+
*/
|
|
254
|
+
filter?: string | {
|
|
255
|
+
[pattern: string]: "js" | "css" | boolean;
|
|
256
|
+
} | ((filePath: string) => "js" | "css" | boolean)
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/** (V8 only) {boolean} Enable/Disable ignoring uncovered codes with the special comments: v8 ignore next/next N/start/stop */
|
|
260
|
+
v8Ignore?: boolean;
|
|
261
|
+
|
|
262
|
+
/** (Istanbul only) defaultSummarizer, sourceFinder */
|
|
263
|
+
|
|
264
|
+
/** {boolean} Generate lcov.info file, same as lcovonly report. Defaults to false. */
|
|
265
|
+
lcov?: boolean;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* {function} Source path handler.
|
|
269
|
+
*
|
|
270
|
+
* {object} Replace key with value.
|
|
271
|
+
* */
|
|
272
|
+
sourcePath?: ((filePath: string) => string) | {
|
|
273
|
+
[key: string]: string;
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
/** {string|function} Specify the report path, especially when there are multiple reports. Defaults to outputDir/index.html. */
|
|
277
|
+
reportPath?: string | (() => string);
|
|
278
|
+
|
|
279
|
+
/** {array} watermarks for low/medium/high. Defaults to [50, 80]
|
|
280
|
+
* {object} { bytes:[50,80], statements:[50,80], branches:[50,80], functions:[50,80], lines:[50,80] } */
|
|
281
|
+
watermarks?: Watermarks;
|
|
282
|
+
|
|
283
|
+
/** {boolean} Indicates whether to clean previous files in output dir before generating report. Defaults to true. */
|
|
284
|
+
clean?: boolean;
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* {boolean} Indicates whether to clean previous cache in output dir before generating report. Defaults to false.
|
|
288
|
+
*
|
|
289
|
+
* If true, the API `cleanCache()` will execute automatically.
|
|
290
|
+
*/
|
|
291
|
+
cleanCache?: boolean;
|
|
292
|
+
|
|
293
|
+
/** {function} onEnd hook */
|
|
294
|
+
onEnd?: (coverageResults: CoverageResults) => Promise<void>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface McrCliOptions extends CoverageReportOptions {
|
|
298
|
+
/** {function} onStart hook */
|
|
299
|
+
onStart?: (coverageReport: CoverageReport) => Promise<void>;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
export class CoverageReport {
|
|
303
|
+
|
|
304
|
+
constructor(options?: CoverageReportOptions);
|
|
305
|
+
|
|
306
|
+
/** add coverage data: {array} V8 format, {object} Istanbul format */
|
|
307
|
+
add: (coverageData: any[] | any) => Promise<AddedResults>;
|
|
308
|
+
|
|
309
|
+
/** generate report */
|
|
310
|
+
generate: () => Promise<CoverageResults>;
|
|
311
|
+
|
|
312
|
+
/** check if cache exists */
|
|
313
|
+
hasCache: () => boolean;
|
|
314
|
+
|
|
315
|
+
/** clean previous cache, return `false` if no cache */
|
|
316
|
+
cleanCache: () => boolean;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export interface CoverageSnapshot {
|
|
320
|
+
type: "v8" | "istanbul";
|
|
321
|
+
summary: {
|
|
322
|
+
bytes?: string;
|
|
323
|
+
statements: string;
|
|
324
|
+
branches: string;
|
|
325
|
+
functions: string;
|
|
326
|
+
lines: string;
|
|
327
|
+
},
|
|
328
|
+
files: {
|
|
329
|
+
[sourcePath: string]: {
|
|
330
|
+
bytes?: string;
|
|
331
|
+
statements: string;
|
|
332
|
+
branches: string;
|
|
333
|
+
functions: string;
|
|
334
|
+
lines: string;
|
|
335
|
+
uncoveredLines: string;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** get snapshot from coverage report data */
|
|
341
|
+
export function getSnapshot(coverageResults: CoverageResults): CoverageSnapshot;
|
|
342
|
+
|
|
343
|
+
/** diff two snapshots */
|
|
344
|
+
export function diffSnapshot(oldData: CoverageSnapshot, newData: CoverageSnapshot, diffOptions: {
|
|
345
|
+
skipEqual?: boolean;
|
|
346
|
+
showSummary?: boolean;
|
|
347
|
+
maxCols?: number;
|
|
348
|
+
metrics?: Array<"bytes" | "statements" | "branches" | "functions" | "lines">;
|
|
349
|
+
}): {
|
|
350
|
+
change: boolean;
|
|
351
|
+
results: any[];
|
|
352
|
+
message: string;
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
/** create coverage report */
|
|
358
|
+
declare function MCR(options?: MCR.CoverageReportOptions): MCR.CoverageReport;
|
|
359
|
+
|
|
360
|
+
export = MCR;
|