monocart-reporter 1.7.8 → 1.7.10
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 +3 -0
- package/lib/default/options.js +3 -0
- package/lib/generate-data.js +7 -1
- package/lib/platform/share.js +33 -0
- package/lib/runtime/monocart-common.js +1 -1
- package/lib/runtime/monocart-reporter.js +1 -1
- package/lib/runtime/monocart-vendor.js +13 -13
- package/lib/visitor.js +42 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -129,6 +129,9 @@ Separated metadata file (Already included in the above HTML and compressed, it c
|
|
|
129
129
|
// logging levels: off, error, info, debug
|
|
130
130
|
logging: 'info',
|
|
131
131
|
|
|
132
|
+
// timezone offset in minutes, GMT+0800 = -480
|
|
133
|
+
timezoneOffset: 0,
|
|
134
|
+
|
|
132
135
|
// global coverage settings for addCoverageReport API
|
|
133
136
|
coverage: null,
|
|
134
137
|
// coverage: {
|
package/lib/default/options.js
CHANGED
package/lib/generate-data.js
CHANGED
|
@@ -26,6 +26,12 @@ const artifactsHandler = async (visitor, options) => {
|
|
|
26
26
|
return artifacts;
|
|
27
27
|
};
|
|
28
28
|
|
|
29
|
+
const getReportDate = (timestampStart, timezoneOffset = 0) => {
|
|
30
|
+
// in minutes
|
|
31
|
+
const offset = Util.toNum(timezoneOffset);
|
|
32
|
+
return timestampStart + offset * 60 * 1000;
|
|
33
|
+
};
|
|
34
|
+
|
|
29
35
|
const generateData = async (results) => {
|
|
30
36
|
|
|
31
37
|
Util.logInfo('generating report data ...');
|
|
@@ -103,7 +109,7 @@ const generateData = async (results) => {
|
|
|
103
109
|
system.ticks.push(tickInfo);
|
|
104
110
|
|
|
105
111
|
// let start timestamp as date
|
|
106
|
-
const date = system.timestampStart;
|
|
112
|
+
const date = getReportDate(system.timestampStart, options.timezoneOffset);
|
|
107
113
|
const dateH = new Date(date).toLocaleString();
|
|
108
114
|
|
|
109
115
|
// end timestamp for duration
|
package/lib/platform/share.js
CHANGED
|
@@ -194,6 +194,39 @@ const Util = {
|
|
|
194
194
|
return 'high';
|
|
195
195
|
},
|
|
196
196
|
|
|
197
|
+
isJsonType(contentType) {
|
|
198
|
+
if (contentType) {
|
|
199
|
+
if (contentType === 'application/json' || contentType === 'json') {
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
return false;
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
isMarkdownType(contentType) {
|
|
207
|
+
if (contentType) {
|
|
208
|
+
if (contentType === 'text/markdown' || contentType === 'markdown') {
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return false;
|
|
213
|
+
},
|
|
214
|
+
|
|
215
|
+
isTextType(contentType) {
|
|
216
|
+
if (contentType) {
|
|
217
|
+
if (contentType.startsWith('text')) {
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
if (Util.isMarkdownType(contentType)) {
|
|
221
|
+
return true;
|
|
222
|
+
}
|
|
223
|
+
if (Util.isJsonType(contentType)) {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
return false;
|
|
228
|
+
},
|
|
229
|
+
|
|
197
230
|
// =============================================================================
|
|
198
231
|
// svg
|
|
199
232
|
|