ortoni-report 2.0.9 → 3.0.0

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/dist/cli/cli.mjs CHANGED
@@ -4,11 +4,12 @@ import {
4
4
  __require,
5
5
  __toESM,
6
6
  startReportServer
7
- } from "../chunk-RHM5OWYN.mjs";
7
+ } from "../chunk-DW4XGLAZ.mjs";
8
8
 
9
9
  // node_modules/commander/lib/error.js
10
10
  var require_error = __commonJS({
11
11
  "node_modules/commander/lib/error.js"(exports) {
12
+ "use strict";
12
13
  var CommanderError2 = class extends Error {
13
14
  /**
14
15
  * Constructs the CommanderError class
@@ -44,6 +45,7 @@ var require_error = __commonJS({
44
45
  // node_modules/commander/lib/argument.js
45
46
  var require_argument = __commonJS({
46
47
  "node_modules/commander/lib/argument.js"(exports) {
48
+ "use strict";
47
49
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
48
50
  var Argument2 = class {
49
51
  /**
@@ -171,6 +173,7 @@ var require_argument = __commonJS({
171
173
  // node_modules/commander/lib/help.js
172
174
  var require_help = __commonJS({
173
175
  "node_modules/commander/lib/help.js"(exports) {
176
+ "use strict";
174
177
  var { humanReadableArgName } = require_argument();
175
178
  var Help2 = class {
176
179
  constructor() {
@@ -247,8 +250,7 @@ var require_help = __commonJS({
247
250
  * @returns {Option[]}
248
251
  */
249
252
  visibleGlobalOptions(cmd) {
250
- if (!this.showGlobalOptions)
251
- return [];
253
+ if (!this.showGlobalOptions) return [];
252
254
  const globalOptions = [];
253
255
  for (let ancestorCmd = cmd.parent; ancestorCmd; ancestorCmd = ancestorCmd.parent) {
254
256
  const visibleOptions = ancestorCmd.options.filter(
@@ -559,11 +561,9 @@ var require_help = __commonJS({
559
561
  wrap(str, width, indent, minColumnWidth = 40) {
560
562
  const indents = " \\f\\t\\v\xA0\u1680\u2000-\u200A\u202F\u205F\u3000\uFEFF";
561
563
  const manualIndent = new RegExp(`[\\n][${indents}]+`);
562
- if (str.match(manualIndent))
563
- return str;
564
+ if (str.match(manualIndent)) return str;
564
565
  const columnWidth = width - indent;
565
- if (columnWidth < minColumnWidth)
566
- return str;
566
+ if (columnWidth < minColumnWidth) return str;
567
567
  const leadingStr = str.slice(0, indent);
568
568
  const columnText = str.slice(indent).replace("\r\n", "\n");
569
569
  const indentString = " ".repeat(indent);
@@ -576,8 +576,7 @@ var require_help = __commonJS({
576
576
  );
577
577
  const lines = columnText.match(regex) || [];
578
578
  return leadingStr + lines.map((line, i) => {
579
- if (line === "\n")
580
- return "";
579
+ if (line === "\n") return "";
581
580
  return (i > 0 ? indentString : "") + line.trimEnd();
582
581
  }).join("\n");
583
582
  }
@@ -589,6 +588,7 @@ var require_help = __commonJS({
589
588
  // node_modules/commander/lib/option.js
590
589
  var require_option = __commonJS({
591
590
  "node_modules/commander/lib/option.js"(exports) {
591
+ "use strict";
592
592
  var { InvalidArgumentError: InvalidArgumentError2 } = require_error();
593
593
  var Option2 = class {
594
594
  /**
@@ -829,8 +829,7 @@ var require_option = __commonJS({
829
829
  */
830
830
  valueFromOption(value, option) {
831
831
  const optionKey = option.attributeName();
832
- if (!this.dualOptions.has(optionKey))
833
- return true;
832
+ if (!this.dualOptions.has(optionKey)) return true;
834
833
  const preset = this.negativeOptions.get(optionKey).presetArg;
835
834
  const negativeValue = preset !== void 0 ? preset : false;
836
835
  return option.negate === (negativeValue === value);
@@ -862,6 +861,7 @@ var require_option = __commonJS({
862
861
  // node_modules/commander/lib/suggestSimilar.js
863
862
  var require_suggestSimilar = __commonJS({
864
863
  "node_modules/commander/lib/suggestSimilar.js"(exports) {
864
+ "use strict";
865
865
  var maxDistance = 3;
866
866
  function editDistance(a, b) {
867
867
  if (Math.abs(a.length - b.length) > maxDistance)
@@ -897,8 +897,7 @@ var require_suggestSimilar = __commonJS({
897
897
  return d[a.length][b.length];
898
898
  }
899
899
  function suggestSimilar(word, candidates) {
900
- if (!candidates || candidates.length === 0)
901
- return "";
900
+ if (!candidates || candidates.length === 0) return "";
902
901
  candidates = Array.from(new Set(candidates));
903
902
  const searchingOptions = word.startsWith("--");
904
903
  if (searchingOptions) {
@@ -909,8 +908,7 @@ var require_suggestSimilar = __commonJS({
909
908
  let bestDistance = maxDistance;
910
909
  const minSimilarity = 0.4;
911
910
  candidates.forEach((candidate) => {
912
- if (candidate.length <= 1)
913
- return;
911
+ if (candidate.length <= 1) return;
914
912
  const distance = editDistance(word, candidate);
915
913
  const length = Math.max(word.length, candidate.length);
916
914
  const similarity = (length - distance) / length;
@@ -944,17 +942,18 @@ var require_suggestSimilar = __commonJS({
944
942
  // node_modules/commander/lib/command.js
945
943
  var require_command = __commonJS({
946
944
  "node_modules/commander/lib/command.js"(exports) {
947
- var EventEmitter = __require("events").EventEmitter;
948
- var childProcess = __require("child_process");
949
- var path2 = __require("path");
950
- var fs2 = __require("fs");
951
- var process2 = __require("process");
945
+ "use strict";
946
+ var EventEmitter = __require("node:events").EventEmitter;
947
+ var childProcess = __require("node:child_process");
948
+ var path2 = __require("node:path");
949
+ var fs2 = __require("node:fs");
950
+ var process2 = __require("node:process");
952
951
  var { Argument: Argument2, humanReadableArgName } = require_argument();
953
952
  var { CommanderError: CommanderError2 } = require_error();
954
953
  var { Help: Help2 } = require_help();
955
954
  var { Option: Option2, DualOptions } = require_option();
956
955
  var { suggestSimilar } = require_suggestSimilar();
957
- var Command2 = class extends EventEmitter {
956
+ var Command2 = class _Command extends EventEmitter {
958
957
  /**
959
958
  * Initialize a new `Command`.
960
959
  *
@@ -1077,17 +1076,14 @@ var require_command = __commonJS({
1077
1076
  cmd.description(desc);
1078
1077
  cmd._executableHandler = true;
1079
1078
  }
1080
- if (opts.isDefault)
1081
- this._defaultCommandName = cmd._name;
1079
+ if (opts.isDefault) this._defaultCommandName = cmd._name;
1082
1080
  cmd._hidden = !!(opts.noHelp || opts.hidden);
1083
1081
  cmd._executableFile = opts.executableFile || null;
1084
- if (args)
1085
- cmd.arguments(args);
1082
+ if (args) cmd.arguments(args);
1086
1083
  this._registerCommand(cmd);
1087
1084
  cmd.parent = this;
1088
1085
  cmd.copyInheritedSettings(this);
1089
- if (desc)
1090
- return this;
1086
+ if (desc) return this;
1091
1087
  return cmd;
1092
1088
  }
1093
1089
  /**
@@ -1100,7 +1096,7 @@ var require_command = __commonJS({
1100
1096
  * @return {Command} new command
1101
1097
  */
1102
1098
  createCommand(name) {
1103
- return new Command2(name);
1099
+ return new _Command(name);
1104
1100
  }
1105
1101
  /**
1106
1102
  * You can customise the help with a subclass of Help by overriding createHelp,
@@ -1119,8 +1115,7 @@ var require_command = __commonJS({
1119
1115
  * @return {(Command | object)} `this` command for chaining, or stored configuration
1120
1116
  */
1121
1117
  configureHelp(configuration) {
1122
- if (configuration === void 0)
1123
- return this._helpConfiguration;
1118
+ if (configuration === void 0) return this._helpConfiguration;
1124
1119
  this._helpConfiguration = configuration;
1125
1120
  return this;
1126
1121
  }
@@ -1143,8 +1138,7 @@ var require_command = __commonJS({
1143
1138
  * @return {(Command | object)} `this` command for chaining, or stored configuration
1144
1139
  */
1145
1140
  configureOutput(configuration) {
1146
- if (configuration === void 0)
1147
- return this._outputConfiguration;
1141
+ if (configuration === void 0) return this._outputConfiguration;
1148
1142
  Object.assign(this._outputConfiguration, configuration);
1149
1143
  return this;
1150
1144
  }
@@ -1155,8 +1149,7 @@ var require_command = __commonJS({
1155
1149
  * @return {Command} `this` command for chaining
1156
1150
  */
1157
1151
  showHelpAfterError(displayHelp = true) {
1158
- if (typeof displayHelp !== "string")
1159
- displayHelp = !!displayHelp;
1152
+ if (typeof displayHelp !== "string") displayHelp = !!displayHelp;
1160
1153
  this._showHelpAfterError = displayHelp;
1161
1154
  return this;
1162
1155
  }
@@ -1185,10 +1178,8 @@ var require_command = __commonJS({
1185
1178
  - specify the name in Command constructor or using .name()`);
1186
1179
  }
1187
1180
  opts = opts || {};
1188
- if (opts.isDefault)
1189
- this._defaultCommandName = cmd._name;
1190
- if (opts.noHelp || opts.hidden)
1191
- cmd._hidden = true;
1181
+ if (opts.isDefault) this._defaultCommandName = cmd._name;
1182
+ if (opts.noHelp || opts.hidden) cmd._hidden = true;
1192
1183
  this._registerCommand(cmd);
1193
1184
  cmd.parent = this;
1194
1185
  cmd._checkForBrokenPassThrough();
@@ -1294,10 +1285,8 @@ var require_command = __commonJS({
1294
1285
  const helpDescription = description ?? "display help for command";
1295
1286
  const helpCommand = this.createCommand(helpName);
1296
1287
  helpCommand.helpOption(false);
1297
- if (helpArgs)
1298
- helpCommand.arguments(helpArgs);
1299
- if (helpDescription)
1300
- helpCommand.description(helpDescription);
1288
+ if (helpArgs) helpCommand.arguments(helpArgs);
1289
+ if (helpDescription) helpCommand.description(helpDescription);
1301
1290
  this._addImplicitHelpCommand = true;
1302
1291
  this._helpCommand = helpCommand;
1303
1292
  return this;
@@ -1890,15 +1879,12 @@ Expecting one of '${allowedValues.join("', '")}'`);
1890
1879
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1891
1880
  function findFile(baseDir, baseName) {
1892
1881
  const localBin = path2.resolve(baseDir, baseName);
1893
- if (fs2.existsSync(localBin))
1894
- return localBin;
1895
- if (sourceExt.includes(path2.extname(baseName)))
1896
- return void 0;
1882
+ if (fs2.existsSync(localBin)) return localBin;
1883
+ if (sourceExt.includes(path2.extname(baseName))) return void 0;
1897
1884
  const foundExt = sourceExt.find(
1898
1885
  (ext) => fs2.existsSync(`${localBin}${ext}`)
1899
1886
  );
1900
- if (foundExt)
1901
- return `${localBin}${foundExt}`;
1887
+ if (foundExt) return `${localBin}${foundExt}`;
1902
1888
  return void 0;
1903
1889
  }
1904
1890
  this._checkForMissingMandatoryOptions();
@@ -2003,8 +1989,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2003
1989
  */
2004
1990
  _dispatchSubcommand(commandName, operands, unknown) {
2005
1991
  const subCommand = this._findCommand(commandName);
2006
- if (!subCommand)
2007
- this.help({ error: true });
1992
+ if (!subCommand) this.help({ error: true });
2008
1993
  let promiseChain;
2009
1994
  promiseChain = this._chainOrCallSubCommandHook(
2010
1995
  promiseChain,
@@ -2247,8 +2232,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2247
2232
  * @return {Command | undefined}
2248
2233
  */
2249
2234
  _findCommand(name) {
2250
- if (!name)
2251
- return void 0;
2235
+ if (!name) return void 0;
2252
2236
  return this.commands.find(
2253
2237
  (cmd) => cmd._name === name || cmd._aliases.includes(name)
2254
2238
  );
@@ -2341,8 +2325,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2341
2325
  while (args.length) {
2342
2326
  const arg = args.shift();
2343
2327
  if (arg === "--") {
2344
- if (dest === unknown)
2345
- dest.push(arg);
2328
+ if (dest === unknown) dest.push(arg);
2346
2329
  dest.push(...args);
2347
2330
  break;
2348
2331
  }
@@ -2356,8 +2339,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2356
2339
  if (option) {
2357
2340
  if (option.required) {
2358
2341
  const value = args.shift();
2359
- if (value === void 0)
2360
- this.optionMissingArgument(option);
2342
+ if (value === void 0) this.optionMissingArgument(option);
2361
2343
  this.emit(`option:${option.name()}`, value);
2362
2344
  } else if (option.optional) {
2363
2345
  let value = null;
@@ -2398,25 +2380,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
2398
2380
  if ((this._enablePositionalOptions || this._passThroughOptions) && operands.length === 0 && unknown.length === 0) {
2399
2381
  if (this._findCommand(arg)) {
2400
2382
  operands.push(arg);
2401
- if (args.length > 0)
2402
- unknown.push(...args);
2383
+ if (args.length > 0) unknown.push(...args);
2403
2384
  break;
2404
2385
  } else if (this._getHelpCommand() && arg === this._getHelpCommand().name()) {
2405
2386
  operands.push(arg);
2406
- if (args.length > 0)
2407
- operands.push(...args);
2387
+ if (args.length > 0) operands.push(...args);
2408
2388
  break;
2409
2389
  } else if (this._defaultCommandName) {
2410
2390
  unknown.push(arg);
2411
- if (args.length > 0)
2412
- unknown.push(...args);
2391
+ if (args.length > 0) unknown.push(...args);
2413
2392
  break;
2414
2393
  }
2415
2394
  }
2416
2395
  if (this._passThroughOptions) {
2417
2396
  dest.push(arg);
2418
- if (args.length > 0)
2419
- dest.push(...args);
2397
+ if (args.length > 0) dest.push(...args);
2420
2398
  break;
2421
2399
  }
2422
2400
  dest.push(arg);
@@ -2595,8 +2573,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2595
2573
  * @private
2596
2574
  */
2597
2575
  unknownOption(flag) {
2598
- if (this._allowUnknownOption)
2599
- return;
2576
+ if (this._allowUnknownOption) return;
2600
2577
  let suggestion = "";
2601
2578
  if (flag.startsWith("--") && this._showSuggestionAfterError) {
2602
2579
  let candidateFlags = [];
@@ -2618,8 +2595,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2618
2595
  * @private
2619
2596
  */
2620
2597
  _excessArguments(receivedArgs) {
2621
- if (this._allowExcessArguments)
2622
- return;
2598
+ if (this._allowExcessArguments) return;
2623
2599
  const expected = this.registeredArguments.length;
2624
2600
  const s = expected === 1 ? "" : "s";
2625
2601
  const forSubcommand = this.parent ? ` for '${this.name()}'` : "";
@@ -2638,8 +2614,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2638
2614
  const candidateNames = [];
2639
2615
  this.createHelp().visibleCommands(this).forEach((command) => {
2640
2616
  candidateNames.push(command.name());
2641
- if (command.alias())
2642
- candidateNames.push(command.alias());
2617
+ if (command.alias()) candidateNames.push(command.alias());
2643
2618
  });
2644
2619
  suggestion = suggestSimilar(unknownName, candidateNames);
2645
2620
  }
@@ -2659,8 +2634,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2659
2634
  * @return {(this | string | undefined)} `this` command for chaining, or version string if no arguments
2660
2635
  */
2661
2636
  version(str, flags, description) {
2662
- if (str === void 0)
2663
- return this._version;
2637
+ if (str === void 0) return this._version;
2664
2638
  this._version = str;
2665
2639
  flags = flags || "-V, --version";
2666
2640
  description = description || "output the version number";
@@ -2697,8 +2671,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2697
2671
  * @return {(string|Command)}
2698
2672
  */
2699
2673
  summary(str) {
2700
- if (str === void 0)
2701
- return this._summary;
2674
+ if (str === void 0) return this._summary;
2702
2675
  this._summary = str;
2703
2676
  return this;
2704
2677
  }
@@ -2711,8 +2684,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2711
2684
  * @return {(string|Command)}
2712
2685
  */
2713
2686
  alias(alias) {
2714
- if (alias === void 0)
2715
- return this._aliases[0];
2687
+ if (alias === void 0) return this._aliases[0];
2716
2688
  let command = this;
2717
2689
  if (this.commands.length !== 0 && this.commands[this.commands.length - 1]._executableHandler) {
2718
2690
  command = this.commands[this.commands.length - 1];
@@ -2738,8 +2710,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2738
2710
  * @return {(string[]|Command)}
2739
2711
  */
2740
2712
  aliases(aliases) {
2741
- if (aliases === void 0)
2742
- return this._aliases;
2713
+ if (aliases === void 0) return this._aliases;
2743
2714
  aliases.forEach((alias) => this.alias(alias));
2744
2715
  return this;
2745
2716
  }
@@ -2751,8 +2722,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2751
2722
  */
2752
2723
  usage(str) {
2753
2724
  if (str === void 0) {
2754
- if (this._usage)
2755
- return this._usage;
2725
+ if (this._usage) return this._usage;
2756
2726
  const args = this.registeredArguments.map((arg) => {
2757
2727
  return humanReadableArgName(arg);
2758
2728
  });
@@ -2772,8 +2742,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2772
2742
  * @return {(string|Command)}
2773
2743
  */
2774
2744
  name(str) {
2775
- if (str === void 0)
2776
- return this._name;
2745
+ if (str === void 0) return this._name;
2777
2746
  this._name = str;
2778
2747
  return this;
2779
2748
  }
@@ -2805,8 +2774,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2805
2774
  * @return {(string|null|Command)}
2806
2775
  */
2807
2776
  executableDir(path3) {
2808
- if (path3 === void 0)
2809
- return this._executableDir;
2777
+ if (path3 === void 0) return this._executableDir;
2810
2778
  this._executableDir = path3;
2811
2779
  return this;
2812
2780
  }
@@ -3018,6 +2986,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3018
2986
  // node_modules/commander/index.js
3019
2987
  var require_commander = __commonJS({
3020
2988
  "node_modules/commander/index.js"(exports) {
2989
+ "use strict";
3021
2990
  var { Argument: Argument2 } = require_argument();
3022
2991
  var { Command: Command2 } = require_command();
3023
2992
  var { CommanderError: CommanderError2, InvalidArgumentError: InvalidArgumentError2 } = require_error();
@@ -0,0 +1,114 @@
1
+ import { Reporter, FullConfig, Suite, TestCase, TestResult, TestError, FullResult } from '@playwright/test/reporter';
2
+
3
+ /**
4
+ * Configuration options for OrtoniReport.
5
+ */
6
+ interface OrtoniReportConfig {
7
+ /**
8
+ * Open the report in local host (Trace viewer is accessible only in localhost)
9
+ * @example "always"| "never"| "on-failure";
10
+ * @default "never"
11
+ */
12
+ open?: "always" | "never" | "on-failure";
13
+ /**
14
+ * The title of the HTML report.
15
+ * @example "Ortoni Playwright Test Report"
16
+ */
17
+ title?: string;
18
+ /**
19
+ * Add project on the list of the tests? (Filtering projects still works if hidden)
20
+ * @example true to display, false to hide.
21
+ * @default false
22
+ */
23
+ showProject?: boolean;
24
+ /**
25
+ * The name of the project.
26
+ * @example "Ortoni Project"
27
+ */
28
+ projectName?: string;
29
+ /**
30
+ * The name of the author.
31
+ * @example "Koushik Chatterjee"
32
+ */
33
+ authorName?: string;
34
+ /**
35
+ * The type of tests being run.
36
+ * @example "Regression"
37
+ */
38
+ testType?: string;
39
+ /**
40
+ * The preferred theme for the report.
41
+ * Can be either "light" or "dark".
42
+ * @default "System theme"
43
+ * @example "dark"
44
+ */
45
+ preferredTheme?: "light" | "dark";
46
+ /**
47
+ * If true, images will be encoded in base64.
48
+ * @default false
49
+ * @example true
50
+ */
51
+ base64Image?: boolean;
52
+ /**
53
+ * The local relative of the logo image.
54
+ * Recommended to keep within the ${folderPath} folder
55
+ * @example "folderPath/logo.png"
56
+ */
57
+ logo?: string;
58
+ /**
59
+ * The filename to the html report.
60
+ * @example "index.html"
61
+ * @default "ortoni-report.html"
62
+ */
63
+ filename?: string;
64
+ /**
65
+ * The folder name.
66
+ * @example "report"
67
+ * @default "ortoni-report"
68
+ */
69
+ folderPath?: string;
70
+ /**
71
+ * Port to connect
72
+ * @example 3600
73
+ */
74
+ port?: number;
75
+ /**
76
+ * Display console logs?
77
+ * @example boolean
78
+ * @default true
79
+ */
80
+ stdIO?: boolean;
81
+ /**
82
+ * Metadata for the report. ['TestCycle': 'Cycle 1', 'TestEnvironment':'QA', etc]
83
+ * @example { "key": "value" } as string
84
+ */
85
+ meta?: Record<string, string>;
86
+ }
87
+
88
+ declare class OrtoniReport implements Reporter {
89
+ private ortoniConfig;
90
+ private testResultProcessor;
91
+ private htmlGenerator;
92
+ private fileManager;
93
+ private serverManager;
94
+ private results;
95
+ private projectSet;
96
+ private overAllStatus;
97
+ private folderPath;
98
+ private outputFilename;
99
+ private outputPath;
100
+ private dbManager;
101
+ private shouldGenerateReport;
102
+ private showConsoleLogs;
103
+ constructor(ortoniConfig?: OrtoniReportConfig);
104
+ private reportsCount;
105
+ onBegin(config: FullConfig, _suite: Suite): Promise<void>;
106
+ onStdOut(chunk: string | Buffer, _test: void | TestCase, _result: void | TestResult): void;
107
+ onTestEnd(test: TestCase, result: TestResult): void;
108
+ printsToStdio(): boolean;
109
+ onError(error: TestError): void;
110
+ onEnd(result: FullResult): Promise<void>;
111
+ onExit(): Promise<void>;
112
+ }
113
+
114
+ export { OrtoniReport, type OrtoniReportConfig, OrtoniReport as default };