monocart-reporter 2.4.8 → 2.5.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/lib/cli.js +2 -2
- package/lib/common.js +2 -4
- package/lib/default/columns.js +1 -1
- package/lib/default/options.js +2 -2
- package/lib/default/summary.js +2 -2
- package/lib/index.js +2 -2
- package/lib/merge-data.js +2 -2
- package/lib/packages/monocart-network.js +1 -1
- package/lib/packages/monocart-reporter-app.js +1 -1
- package/lib/packages/monocart-vendor.js +21 -21
- package/lib/utils/util.js +10 -10
- package/lib/visitor.js +12 -9
- package/package.json +8 -7
package/lib/utils/util.js
CHANGED
|
@@ -8,7 +8,7 @@ const CG = require('console-grid');
|
|
|
8
8
|
const Share = require('../platform/share.js');
|
|
9
9
|
const { deflateSync } = require('lz-utils');
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const getDefaultOptions = require('../default/options.js');
|
|
12
12
|
|
|
13
13
|
const assetsName = 'assets';
|
|
14
14
|
|
|
@@ -58,6 +58,13 @@ const Util = {
|
|
|
58
58
|
return hash.digest('hex');
|
|
59
59
|
},
|
|
60
60
|
|
|
61
|
+
calculateId: (id) => {
|
|
62
|
+
if (id) {
|
|
63
|
+
return Util.calculateSha1(id).slice(0, 20);
|
|
64
|
+
}
|
|
65
|
+
return Util.uid();
|
|
66
|
+
},
|
|
67
|
+
|
|
61
68
|
parseComments: (input) => {
|
|
62
69
|
const str = `${input}`;
|
|
63
70
|
// starts with @ , ends without @ encodeURIComponent("@") %40
|
|
@@ -90,7 +97,7 @@ const Util = {
|
|
|
90
97
|
}
|
|
91
98
|
// then check string
|
|
92
99
|
if (!outputFile || typeof outputFile !== 'string') {
|
|
93
|
-
outputFile =
|
|
100
|
+
outputFile = getDefaultOptions().outputFile;
|
|
94
101
|
}
|
|
95
102
|
return path.resolve(outputFile);
|
|
96
103
|
},
|
|
@@ -122,7 +129,7 @@ const Util = {
|
|
|
122
129
|
},
|
|
123
130
|
|
|
124
131
|
resolveTestIdWithRetry: (testInfo) => {
|
|
125
|
-
const id = Util.
|
|
132
|
+
const id = Util.calculateId(testInfo.testId);
|
|
126
133
|
const retry = testInfo.retry;
|
|
127
134
|
if (retry > 0) {
|
|
128
135
|
return `${id}-retry${retry}`;
|
|
@@ -266,13 +273,6 @@ const Util = {
|
|
|
266
273
|
return '\n';
|
|
267
274
|
},
|
|
268
275
|
|
|
269
|
-
shortTestId: (id) => {
|
|
270
|
-
if (id) {
|
|
271
|
-
return id.split('-').pop();
|
|
272
|
-
}
|
|
273
|
-
return Util.uid();
|
|
274
|
-
},
|
|
275
|
-
|
|
276
276
|
getAttachmentPathExtras: function(d) {
|
|
277
277
|
return {
|
|
278
278
|
name: d.name,
|
package/lib/visitor.js
CHANGED
|
@@ -6,7 +6,7 @@ const {
|
|
|
6
6
|
} = require('./packages/monocart-vendor.js');
|
|
7
7
|
const Util = require('./utils/util.js');
|
|
8
8
|
const commentsPlugin = require('./plugins/comments.js');
|
|
9
|
-
const
|
|
9
|
+
const getDefaultColumns = require('./default/columns.js');
|
|
10
10
|
|
|
11
11
|
// retired, just warning for old babel parser
|
|
12
12
|
let collectWarning = '"collect.comments()" has been deprecated (replaced with new option "customFieldsInComments: true/false" in version 2.2.0), please remove the code related to "collect.comments()" in custom "visitor".';
|
|
@@ -35,8 +35,9 @@ class Visitor {
|
|
|
35
35
|
|
|
36
36
|
async start() {
|
|
37
37
|
|
|
38
|
+
const columns = getDefaultColumns();
|
|
38
39
|
// default columns not detailed in report
|
|
39
|
-
|
|
40
|
+
columns.forEach((item) => {
|
|
40
41
|
item.detailed = false;
|
|
41
42
|
});
|
|
42
43
|
|
|
@@ -45,16 +46,16 @@ class Visitor {
|
|
|
45
46
|
|
|
46
47
|
// user defined custom columns
|
|
47
48
|
const handler = this.options.columns;
|
|
48
|
-
if (typeof handler === 'function') {
|
|
49
|
+
if (!this.columnsUpdated && typeof handler === 'function') {
|
|
49
50
|
// prevent repeated execution
|
|
50
|
-
this.
|
|
51
|
+
this.columnsUpdated = true;
|
|
51
52
|
|
|
52
53
|
// update default columns by user
|
|
53
|
-
handler.call(this,
|
|
54
|
+
handler.call(this, columns);
|
|
54
55
|
|
|
55
56
|
// maybe a tree
|
|
56
57
|
const customVisitors = [];
|
|
57
|
-
this.initCustomHandler(
|
|
58
|
+
this.initCustomHandler(columns, customVisitors, this.formatters);
|
|
58
59
|
if (customVisitors.length) {
|
|
59
60
|
this.customVisitors = customVisitors;
|
|
60
61
|
}
|
|
@@ -62,7 +63,7 @@ class Visitor {
|
|
|
62
63
|
|
|
63
64
|
// console.log(customFormatters);
|
|
64
65
|
|
|
65
|
-
this.columns =
|
|
66
|
+
this.columns = columns;
|
|
66
67
|
this.rows = [];
|
|
67
68
|
this.jobs = [];
|
|
68
69
|
this.artifacts = [];
|
|
@@ -175,7 +176,9 @@ class Visitor {
|
|
|
175
176
|
}
|
|
176
177
|
|
|
177
178
|
// suite uid for report
|
|
178
|
-
const
|
|
179
|
+
const suiteStr = [suite._fileId].concat(suite.titlePath()).filter((it) => it).join(' ');
|
|
180
|
+
// console.log(suiteStr);
|
|
181
|
+
const suiteId = Util.calculateId(suiteStr);
|
|
179
182
|
|
|
180
183
|
const group = {
|
|
181
184
|
id: suiteId,
|
|
@@ -240,7 +243,7 @@ class Visitor {
|
|
|
240
243
|
// const testIdExpression = `[project=${project._internal.id}]${test.titlePath().join('\x1e')}${repeatEachIndexSuffix}`;
|
|
241
244
|
// const testId = fileId + '-' + calculateSha1(testIdExpression).slice(0, 20);
|
|
242
245
|
|
|
243
|
-
const caseId = Util.
|
|
246
|
+
const caseId = Util.calculateId(testCase.id);
|
|
244
247
|
|
|
245
248
|
const caseItem = {
|
|
246
249
|
id: caseId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monocart-reporter",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.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": {
|
|
@@ -47,23 +47,24 @@
|
|
|
47
47
|
"koa": "^2.15.3",
|
|
48
48
|
"koa-static-resolver": "^1.0.6",
|
|
49
49
|
"lz-utils": "^2.0.2",
|
|
50
|
-
"monocart-coverage-reports": "^2.8.
|
|
50
|
+
"monocart-coverage-reports": "^2.8.4",
|
|
51
51
|
"monocart-formatter": "^3.0.0",
|
|
52
52
|
"monocart-locator": "^1.0.0",
|
|
53
|
-
"nodemailer": "^6.9.
|
|
54
|
-
"turbogrid": "^3.
|
|
53
|
+
"nodemailer": "^6.9.14",
|
|
54
|
+
"turbogrid": "^3.2.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@playwright/test": "^1.44.1",
|
|
58
58
|
"axios": "^1.7.2",
|
|
59
59
|
"dotenv": "^16.4.5",
|
|
60
|
-
"eslint": "^9.
|
|
61
|
-
"eslint-config-plus": "^2.0.
|
|
60
|
+
"eslint": "^9.5.0",
|
|
61
|
+
"eslint-config-plus": "^2.0.2",
|
|
62
62
|
"eslint-plugin-html": "^8.1.1",
|
|
63
63
|
"eslint-plugin-vue": "^9.26.0",
|
|
64
|
+
"mermaid": "^10.9.1",
|
|
64
65
|
"open": "8.4.2",
|
|
65
66
|
"stylelint": "^16.6.1",
|
|
66
67
|
"stylelint-config-plus": "^1.1.2",
|
|
67
|
-
"vine-ui": "^3.1.
|
|
68
|
+
"vine-ui": "^3.1.15"
|
|
68
69
|
}
|
|
69
70
|
}
|