monocart-reporter 2.9.10 → 2.9.12

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
@@ -101,7 +101,21 @@ Single HTML file (data compressed), easy to transfer/deploy or open directly any
101
101
  - path-to/your-filename.json (requires option `json` is true)
102
102
  Separated data file which can be used for debugging or data provider (It's included in the above HTML and compressed).
103
103
  - path-to/your-filename.zip (requires option `zip` is true)
104
- Zip file for merging reports
104
+ Zip file for merging reports
105
+ - custom zip options
106
+ ```js
107
+ {
108
+ // zip: true,
109
+ // zip: `${YourOutputDir}/monocart-shard-${your-shard-number}.zip`,
110
+ zip: {
111
+ // custom zip `outputFile`, defaults to reporter `outputFile` but uses `.zip` extension
112
+ outputFile: `${YourOutputDir}/monocart-shard-${your-shard-number}.zip`,
113
+ // clean other report files except for zip file, defaults to false
114
+ clean: true
115
+ }
116
+ }
117
+ ```
118
+
105
119
 
106
120
  ## Reporter Options
107
121
  - Default options: [lib/default/options.js](./lib/default/options.js)
@@ -1036,7 +1050,7 @@ const reportDataList = [
1036
1050
  'path-to/shard2/index.json',
1037
1051
  'path-to/shard3/index.json'
1038
1052
 
1039
- // Or load zip file directly if the output files is zipped
1053
+ // Or load zip file directly if the output files is zipped with option `zip` is true
1040
1054
  // 'path-to/shard1/index.zip',
1041
1055
  // 'path-to/shard2/index.zip',
1042
1056
  // 'path-to/shard3/index.zip'
@@ -1050,6 +1064,7 @@ await merge(reportDataList, {
1050
1064
  }
1051
1065
  });
1052
1066
  ```
1067
+ see [Output](#output) for `zip` options
1053
1068
 
1054
1069
  > Note: The coverage reports will be merged automatically if we specify the `raw` report in coverage options:
1055
1070
  ```js
@@ -5,6 +5,9 @@ module.exports = () => ({
5
5
  // the report name
6
6
  name: '',
7
7
 
8
+ // image url (supports data url)
9
+ logo: null,
10
+
8
11
  // the output html file path (relative process.cwd)
9
12
  outputFile: './monocart-report/index.html',
10
13
 
@@ -144,6 +144,7 @@ const generateData = async (results) => {
144
144
  const reportData = {
145
145
  // for report title
146
146
  name: reportName,
147
+ logo: options.logo,
147
148
 
148
149
  date,
149
150
  dateH,
package/lib/index.d.ts CHANGED
@@ -51,6 +51,12 @@ export type MonocartReporterOptions = {
51
51
  /** the report name */
52
52
  name?: string;
53
53
 
54
+ /**
55
+ * image url, supports data url:
56
+ * `data:image/png;base64,${fs.readFileSync('path-to/your-logo.png').toString('base64')}`
57
+ */
58
+ logo?: string;
59
+
54
60
  /** the output file path (relative process.cwd) */
55
61
  outputFile?: string;
56
62
 
package/lib/merge-data.js CHANGED
@@ -333,6 +333,7 @@ const mergeDataList = async (dataList, options) => {
333
333
  });
334
334
 
335
335
  const reportName = options.name || mergedData.name;
336
+ const reportLogo = options.logo || mergedData.logo;
336
337
 
337
338
  const date = Math.min.apply(null, startDates);
338
339
  const dateH = new Date(date).toLocaleString();
@@ -342,6 +343,7 @@ const mergeDataList = async (dataList, options) => {
342
343
 
343
344
  Object.assign(mergedData, {
344
345
  name: reportName,
346
+ logo: reportLogo,
345
347
 
346
348
  date,
347
349
  dateH,