monocart-reporter 2.9.5 → 2.9.6

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
@@ -1060,14 +1060,17 @@ see example [merge.js](https://github.com/cenfun/monocart-reporter-examples/blob
1060
1060
 
1061
1061
  ### Using `merge` CLI
1062
1062
  ```sh
1063
- # NOTE: The asterisk(*) is a special character which is interpreted by some operating systems (Mac and Linux), please put it in quotes
1064
- npx monocart merge '<glob-patterns>'
1063
+ npx monocart merge <glob-patterns>
1065
1064
 
1066
1065
  # -o --outputFile
1067
- npx monocart merge 'path-to/shard*/index.json' -o merged-reports/index.html
1066
+ npx monocart merge path-to/shard*/index.json -o merged-reports/index.html
1068
1067
 
1069
1068
  # -c --config
1070
- npx monocart merge 'path-to/shard*/my-report.zip' -c mr.config.js
1069
+ npx monocart merge path-to/shard*/my-report.zip -c mr.config.js
1070
+
1071
+ # NOTE: The asterisk(*) is a special character which is interpreted by some operating systems
1072
+ # For example: Mac and Linux, please put it in quotes, but NOT for Windows
1073
+ npx monocart merge 'path-to/shard*/*.zip'
1071
1074
  ```
1072
1075
  The default config files (In order of priority)
1073
1076
  - mr.config.js
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');
@@ -272,6 +272,12 @@ const resolveConfigOptions = async (configPath) => {
272
272
  return configOptions;
273
273
  };
274
274
 
275
+ const exit = (code) => {
276
+ if (code) {
277
+ process.exit(code);
278
+ }
279
+ };
280
+
275
281
  const mergeReports = async (str, cliOptions) => {
276
282
 
277
283
  await initNodeOptions(cliOptions);
@@ -285,6 +291,7 @@ const mergeReports = async (str, cliOptions) => {
285
291
  } else {
286
292
  if (customConfig) {
287
293
  Util.logError(`ERROR: not found config file: ${customConfig}`);
294
+ exit(1);
288
295
  return;
289
296
  }
290
297
  }
@@ -297,15 +304,21 @@ const mergeReports = async (str, cliOptions) => {
297
304
 
298
305
  Util.initLoggingLevel(options.logging);
299
306
 
307
+ Util.logInfo(`glob patterns: ${EC.cyan(str)}`);
308
+
300
309
  const files = await glob(str);
301
310
  if (!Util.isList(files)) {
302
311
  Util.logError(`ERROR: no files found with glob: ${str}`);
312
+ exit(1);
303
313
  return;
304
314
  }
305
- // console.log(files, options);
306
315
 
307
- await merge(files, options);
316
+ Util.logInfo(`glob files: ${files.join(', ')}`);
308
317
 
318
+ const reportData = await merge(files, options);
319
+ if (!reportData) {
320
+ exit(1);
321
+ }
309
322
  };
310
323
 
311
324
  program
@@ -354,6 +354,7 @@ const generateReport = async (reportData, options, rawData) => {
354
354
 
355
355
  Util.logInfo(`view report: ${EC.cyan(`npx monocart show-report ${htmlPath}`)}`);
356
356
 
357
+ return reportData;
357
358
  };
358
359
 
359
360
  module.exports = generateReport;
package/lib/merge-data.js CHANGED
@@ -84,7 +84,7 @@ const getReportData = async (item, num, options) => {
84
84
  // for finding attachments
85
85
  const jsonDir = Util.relativePath(path.dirname(item));
86
86
 
87
- Util.logInfo(`report data loaded: ${item}`);
87
+ Util.logInfo(`report data loaded: ${Util.relativePath(item)}`);
88
88
  return {
89
89
  jsonDir,
90
90
  data
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monocart-reporter",
3
- "version": "2.9.5",
3
+ "version": "2.9.6",
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": {