monocart-reporter 2.4.8 → 2.4.9
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 +3 -3
- 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/utils/util.js +2 -2
- package/lib/visitor.js +8 -7
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
@@ -12,7 +12,7 @@ const Koa = require('koa');
|
|
|
12
12
|
const CG = require('console-grid');
|
|
13
13
|
|
|
14
14
|
const { program, open } = require('./packages/monocart-vendor.js');
|
|
15
|
-
const
|
|
15
|
+
const getDefaultOptions = require('./default/options.js');
|
|
16
16
|
const version = require('../package.json').version;
|
|
17
17
|
|
|
18
18
|
const getInternalIps = () => {
|
|
@@ -102,7 +102,7 @@ const createServer = (app, options) => {
|
|
|
102
102
|
const serveReport = async (p, options) => {
|
|
103
103
|
|
|
104
104
|
if (!p) {
|
|
105
|
-
p =
|
|
105
|
+
p = getDefaultOptions().outputFile;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
const dirs = [];
|
package/lib/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const Util = require('./utils/util.js');
|
|
2
|
-
const
|
|
2
|
+
const getDefaultSummary = require('./default/summary.js');
|
|
3
3
|
const generatePieChart = require('./utils/pie.js');
|
|
4
4
|
|
|
5
5
|
const caseHandler = (item, summary) => {
|
|
@@ -81,9 +81,7 @@ const calculateSummary = (data, options) => {
|
|
|
81
81
|
const tags = {};
|
|
82
82
|
const tagOptions = options.tags || {};
|
|
83
83
|
|
|
84
|
-
const summary =
|
|
85
|
-
... defaultSummary
|
|
86
|
-
};
|
|
84
|
+
const summary = getDefaultSummary();
|
|
87
85
|
// init summary data
|
|
88
86
|
Object.keys(summary).forEach((k) => {
|
|
89
87
|
const item = summary[k];
|
package/lib/default/columns.js
CHANGED
package/lib/default/options.js
CHANGED
package/lib/default/summary.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -2,7 +2,7 @@ const EC = require('eight-colors');
|
|
|
2
2
|
const { getSystemInfo, getTickInfo } = require('./utils/system.js');
|
|
3
3
|
const generateData = require('./generate-data.js');
|
|
4
4
|
const generateReport = require('./generate-report.js');
|
|
5
|
-
const
|
|
5
|
+
const getDefaultOptions = require('./default/options.js');
|
|
6
6
|
const { getTrends } = require('./common.js');
|
|
7
7
|
|
|
8
8
|
const merge = require('./merge-data.js');
|
|
@@ -35,7 +35,7 @@ class MonocartReporter {
|
|
|
35
35
|
const timestampStart = Date.now();
|
|
36
36
|
|
|
37
37
|
this.options = {
|
|
38
|
-
...
|
|
38
|
+
... getDefaultOptions(),
|
|
39
39
|
... userOptions
|
|
40
40
|
};
|
|
41
41
|
|
package/lib/merge-data.js
CHANGED
|
@@ -2,7 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const Util = require('./utils/util.js');
|
|
4
4
|
const generateReport = require('./generate-report.js');
|
|
5
|
-
const
|
|
5
|
+
const getDefaultOptions = require('./default/options.js');
|
|
6
6
|
const { calculateSummary, getTrends } = require('./common.js');
|
|
7
7
|
|
|
8
8
|
const checkReportData = (item) => {
|
|
@@ -180,7 +180,7 @@ module.exports = async (reportDataList, userOptions = {}) => {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
const options = {
|
|
183
|
-
...
|
|
183
|
+
... getDefaultOptions(),
|
|
184
184
|
... userOptions
|
|
185
185
|
};
|
|
186
186
|
|
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
|
|
|
@@ -90,7 +90,7 @@ const Util = {
|
|
|
90
90
|
}
|
|
91
91
|
// then check string
|
|
92
92
|
if (!outputFile || typeof outputFile !== 'string') {
|
|
93
|
-
outputFile =
|
|
93
|
+
outputFile = getDefaultOptions().outputFile;
|
|
94
94
|
}
|
|
95
95
|
return path.resolve(outputFile);
|
|
96
96
|
},
|
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 = [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "monocart-reporter",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.9",
|
|
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": {
|