monocart-reporter 1.7.9 → 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 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: {
@@ -14,6 +14,9 @@ module.exports = {
14
14
  // logging levels: off, error, info, debug
15
15
  logging: 'info',
16
16
 
17
+ // timezone offset in minutes, GMT+0800 = -480
18
+ timezoneOffset: 0,
19
+
17
20
  // global coverage settings for addCoverageReport API
18
21
  coverage: null,
19
22
  // coverage: {
@@ -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
@@ -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