monocart-reporter 1.7.12 → 1.7.13
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/README.md
CHANGED
|
@@ -646,7 +646,7 @@ Attach a coverage report to a test. Arguments:
|
|
|
646
646
|
|
|
647
647
|
### Coverage Options
|
|
648
648
|
- `title` (String) report title.
|
|
649
|
-
- `toIstanbul` (Boolean) Whether to convert to Istanbul report from V8 list. Defaults to `html-spa` report | (String)
|
|
649
|
+
- `toIstanbul` (Boolean) Whether to convert to Istanbul report from V8 list. Defaults to `html-spa` report | (String) report name | (Array) multiple reports. V8 only.
|
|
650
650
|
- `entryFilter` (Function) A filter function to execute for each element in the V8 list. V8 only.
|
|
651
651
|
- `sourceFilter` (Function) A filter function to execute for each element in the sources which unpacked from the source map. Sourcemap only.
|
|
652
652
|
- `watermarks` (Object) Istanbul watermarks, see [here](https://github.com/istanbuljs/istanbuljs/tree/master/packages/istanbul-lib-report) | (Array) V8 watermarks, Defaults to `[50, 80]`.
|
package/lib/index.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ export function attachAuditReport(
|
|
|
28
28
|
* coverage
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
+
export type IstanbulReportConfig = {
|
|
32
|
+
name: string,
|
|
33
|
+
options: any
|
|
34
|
+
}
|
|
35
|
+
|
|
31
36
|
export type CoverageReportOptions = {
|
|
32
37
|
|
|
33
38
|
title?: string,
|
|
@@ -35,7 +40,7 @@ export type CoverageReportOptions = {
|
|
|
35
40
|
outputName?: string,
|
|
36
41
|
|
|
37
42
|
// Whether to convert to Istanbul report
|
|
38
|
-
toIstanbul?: boolean | string,
|
|
43
|
+
toIstanbul?: boolean | string | string[] | IstanbulReportConfig[],
|
|
39
44
|
|
|
40
45
|
// A filter function to execute for each element in the V8 list.
|
|
41
46
|
entryFilter?: (entry: any) => boolean,
|
|
@@ -20,7 +20,7 @@ const defaultOptions = {
|
|
|
20
20
|
// outputDir
|
|
21
21
|
// outputName
|
|
22
22
|
|
|
23
|
-
// (Boolean) Whether to convert to Istanbul report from V8 list. Defaults to `html-spa` report | (String)
|
|
23
|
+
// (Boolean) Whether to convert to Istanbul report from V8 list. Defaults to `html-spa` report | (String) report name | (Array) multiple reports
|
|
24
24
|
toIstanbul: false,
|
|
25
25
|
|
|
26
26
|
// (Function) A filter function to execute for each element in the V8 list.
|
|
@@ -10,6 +10,41 @@ const { istanbulLibReport, istanbulLibCoverage } = require('../../../runtime/mon
|
|
|
10
10
|
|
|
11
11
|
const { initIstanbulSourcePath } = require('../converter/source-path.js');
|
|
12
12
|
|
|
13
|
+
const getIstanbulReportList = (toIstanbul) => {
|
|
14
|
+
if (typeof toIstanbul === 'boolean') {
|
|
15
|
+
return [{
|
|
16
|
+
name: 'html-spa',
|
|
17
|
+
options: {}
|
|
18
|
+
}];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (typeof toIstanbul === 'string') {
|
|
22
|
+
return [{
|
|
23
|
+
name: toIstanbul,
|
|
24
|
+
options: {}
|
|
25
|
+
}];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (Array.isArray(toIstanbul)) {
|
|
29
|
+
return toIstanbul.map((item) => {
|
|
30
|
+
if (typeof item === 'string') {
|
|
31
|
+
return {
|
|
32
|
+
name: item,
|
|
33
|
+
options: {}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
if (item && item.name) {
|
|
37
|
+
return item;
|
|
38
|
+
}
|
|
39
|
+
}).filter((it) => it);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return [{
|
|
43
|
+
name: 'html-spa',
|
|
44
|
+
options: {}
|
|
45
|
+
}];
|
|
46
|
+
};
|
|
47
|
+
|
|
13
48
|
const saveIstanbulReport = (coverageData, fileSources, options) => {
|
|
14
49
|
|
|
15
50
|
const coverageMap = istanbulLibCoverage.createCoverageMap(coverageData);
|
|
@@ -67,18 +102,21 @@ const saveIstanbulReport = (coverageData, fileSources, options) => {
|
|
|
67
102
|
// create a context for report generation
|
|
68
103
|
const context = istanbulLibReport.createContext(contextOptions);
|
|
69
104
|
|
|
70
|
-
//
|
|
105
|
+
// istanbul reports
|
|
106
|
+
let lcovCreated = false;
|
|
71
107
|
if (options.toIstanbul) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
108
|
+
const reportList = getIstanbulReportList(options.toIstanbul);
|
|
109
|
+
reportList.forEach((item) => {
|
|
110
|
+
if (item.name === 'lcovonly') {
|
|
111
|
+
lcovCreated = true;
|
|
112
|
+
}
|
|
113
|
+
const report = istanbulReports.create(item.name, item.options || {});
|
|
114
|
+
report.execute(context);
|
|
115
|
+
});
|
|
78
116
|
}
|
|
79
117
|
|
|
80
118
|
// lcov
|
|
81
|
-
if (options.lcov) {
|
|
119
|
+
if (!lcovCreated && options.lcov) {
|
|
82
120
|
const lcovReport = istanbulReports.create('lcovonly', {});
|
|
83
121
|
lcovReport.execute(context);
|
|
84
122
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monocart-reporter",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.13",
|
|
4
4
|
"description": "A playwright test reporter. Shows suites/cases/steps with tree style, markdown annotations, custom columns/formatters/data collection visitors, console logs, style tags, send email.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|