monocart-reporter 2.6.5 → 2.7.0
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 +14 -7
- package/lib/cli.js +1 -1
- package/lib/generate-data.js +32 -1
- package/lib/merge-data.js +122 -19
- package/lib/packages/monocart-reporter-assets.js +1 -1
- package/lib/plugins/coverage/coverage.js +24 -1
- package/lib/visitor.js +48 -0
- package/package.json +7 -7
|
@@ -125,8 +125,31 @@ const generateGlobalCoverageReport = async (reporterOptions) => {
|
|
|
125
125
|
|
|
126
126
|
};
|
|
127
127
|
|
|
128
|
+
const mergeGlobalCoverageReport = async (coverageRawList, reporterOptions) => {
|
|
129
|
+
const coverageOptions = await getGlobalCoverageOptions(reporterOptions);
|
|
130
|
+
coverageOptions.inputDir = coverageRawList;
|
|
131
|
+
|
|
132
|
+
const coverageReport = MCR(coverageOptions);
|
|
133
|
+
const coverageResults = await coverageReport.generate();
|
|
134
|
+
if (!coverageResults) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const reportPath = coverageResults.reportPath;
|
|
139
|
+
if (reportPath && fs.existsSync(reportPath)) {
|
|
140
|
+
return {
|
|
141
|
+
global: true,
|
|
142
|
+
type: 'coverage',
|
|
143
|
+
name: coverageResults.name,
|
|
144
|
+
path: reportPath
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
};
|
|
149
|
+
|
|
128
150
|
module.exports = {
|
|
129
151
|
addCoverageReport,
|
|
130
152
|
attachCoverageReport,
|
|
131
|
-
generateGlobalCoverageReport
|
|
153
|
+
generateGlobalCoverageReport,
|
|
154
|
+
mergeGlobalCoverageReport
|
|
132
155
|
};
|
package/lib/visitor.js
CHANGED
|
@@ -511,6 +511,9 @@ class Visitor {
|
|
|
511
511
|
return;
|
|
512
512
|
}
|
|
513
513
|
|
|
514
|
+
// fixed expected image path
|
|
515
|
+
this.expectedAttachmentHandler(item, attachments);
|
|
516
|
+
|
|
514
517
|
if (item.body) {
|
|
515
518
|
if (!item.path) {
|
|
516
519
|
this.saveAttachmentBodyHandler(item, i, caseId);
|
|
@@ -555,6 +558,51 @@ class Visitor {
|
|
|
555
558
|
}
|
|
556
559
|
}
|
|
557
560
|
|
|
561
|
+
getImageCategory(item) {
|
|
562
|
+
if (item.contentType && item.contentType.startsWith('image/')) {
|
|
563
|
+
if (item.name) {
|
|
564
|
+
const match = item.name.match(/^(.*)-(expected|actual|diff)(\.[^.]+)?$/);
|
|
565
|
+
if (match) {
|
|
566
|
+
// , name, category, extension
|
|
567
|
+
return match[2];
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
expectedAttachmentHandler(item, attachments) {
|
|
574
|
+
const category = this.getImageCategory(item);
|
|
575
|
+
if (category !== 'expected') {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const actualItem = attachments.find((it) => {
|
|
580
|
+
if (it.retry !== item.retry) {
|
|
581
|
+
return false;
|
|
582
|
+
}
|
|
583
|
+
const c = this.getImageCategory(it);
|
|
584
|
+
if (c === 'actual') {
|
|
585
|
+
return true;
|
|
586
|
+
}
|
|
587
|
+
return false;
|
|
588
|
+
});
|
|
589
|
+
if (!actualItem) {
|
|
590
|
+
return;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// console.log(item, actualItem);
|
|
594
|
+
|
|
595
|
+
const itemDir = path.dirname(actualItem.path);
|
|
596
|
+
const itemPath = path.resolve(itemDir, item.name);
|
|
597
|
+
|
|
598
|
+
if (fs.existsSync(itemPath)) {
|
|
599
|
+
item.path = itemPath;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// no need copy the expected file, it exists
|
|
603
|
+
|
|
604
|
+
}
|
|
605
|
+
|
|
558
606
|
reportHandler(item, itemName, title) {
|
|
559
607
|
|
|
560
608
|
const definition = Util.attachments[itemName];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monocart-reporter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
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": {
|
|
@@ -46,27 +46,27 @@
|
|
|
46
46
|
"koa": "^2.15.3",
|
|
47
47
|
"koa-static-resolver": "^1.0.6",
|
|
48
48
|
"lz-utils": "^2.1.0",
|
|
49
|
-
"monocart-coverage-reports": "^2.10.
|
|
49
|
+
"monocart-coverage-reports": "^2.10.3",
|
|
50
50
|
"monocart-locator": "^1.0.2",
|
|
51
51
|
"nodemailer": "^6.9.14"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@babel/code-frame": "^7.24.7",
|
|
55
|
-
"@playwright/test": "^1.46.
|
|
55
|
+
"@playwright/test": "^1.46.1",
|
|
56
56
|
"ansi-to-html": "^0.7.2",
|
|
57
57
|
"async-tick": "^1.0.0",
|
|
58
58
|
"autolinker": "^4.0.0",
|
|
59
|
-
"axios": "^1.7.
|
|
59
|
+
"axios": "^1.7.5",
|
|
60
60
|
"commander": "^12.1.0",
|
|
61
61
|
"dotenv": "^16.4.5",
|
|
62
|
-
"eslint": "^9.
|
|
62
|
+
"eslint": "^9.9.1",
|
|
63
63
|
"eslint-config-plus": "^2.0.2",
|
|
64
64
|
"eslint-plugin-html": "^8.1.1",
|
|
65
65
|
"eslint-plugin-vue": "^9.27.0",
|
|
66
66
|
"file-saver": "^2.0.5",
|
|
67
67
|
"github-markdown-css": "^5.6.1",
|
|
68
68
|
"marked": "^14.0.0",
|
|
69
|
-
"mermaid": "^
|
|
69
|
+
"mermaid": "^11.0.2",
|
|
70
70
|
"mitt": "^3.0.1",
|
|
71
71
|
"monocart-code-viewer": "^1.1.4",
|
|
72
72
|
"monocart-formatter": "^3.0.0",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"open": "8.4.2",
|
|
75
75
|
"sanitize-filename": "^1.6.3",
|
|
76
76
|
"stack-utils": "^2.0.6",
|
|
77
|
-
"stylelint": "^16.8.
|
|
77
|
+
"stylelint": "^16.8.2",
|
|
78
78
|
"stylelint-config-plus": "^1.1.2",
|
|
79
79
|
"turbogrid": "^3.2.0",
|
|
80
80
|
"vine-ui": "^3.1.16",
|