ortoni-report 4.1.0-test.0 → 4.1.0-test.3

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.
Files changed (3) hide show
  1. package/dist/cli.js +26 -11
  2. package/dist/cli.mjs +26 -11
  3. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -688,6 +688,9 @@ async function mergeAllData(options = {}) {
688
688
  let totalDurationMax = 0;
689
689
  let mergedUserConfig = null;
690
690
  let mergedUserMeta = null;
691
+ const badShards = [];
692
+ const shardCounts = {};
693
+ const shardDurMap = {};
691
694
  for (const file of sortedFiles) {
692
695
  const fullPath = path3.join(folderPath, file);
693
696
  try {
@@ -701,19 +704,25 @@ async function mergeAllData(options = {}) {
701
704
  continue;
702
705
  }
703
706
  shardData.results.forEach((r) => allResults.push(r));
707
+ shardCounts[file] = shardData.results.length;
704
708
  if (Array.isArray(shardData.projectSet)) {
705
709
  shardData.projectSet.forEach((p) => projectSet.add(p));
706
710
  }
707
- const shardDur = Number(shardData.duration);
711
+ const rawShardDur = shardData.duration;
708
712
  let durToAdd = 0;
709
- if (!isNaN(shardDur) && shardDur > 0) {
710
- durToAdd = shardDur;
713
+ let perTestSum = 0;
714
+ if (typeof rawShardDur === "number") {
715
+ durToAdd = rawShardDur;
711
716
  } else {
712
- const perTestSum = (Array.isArray(shardData.results) ? shardData.results : []).map((t) => Number(t.duration) || 0).reduce((a, b) => a + b, 0);
717
+ perTestSum = Array.isArray(shardData.results) ? shardData.results.reduce(
718
+ (acc, t) => acc + (Number(t?.duration) || 0),
719
+ 0
720
+ ) : 0;
713
721
  durToAdd = perTestSum;
714
722
  }
715
723
  totalDurationSum += durToAdd;
716
724
  if (durToAdd > totalDurationMax) totalDurationMax = durToAdd;
725
+ shardDurMap[file] = durToAdd;
717
726
  if (shardData.userConfig) {
718
727
  if (!mergedUserConfig) mergedUserConfig = { ...shardData.userConfig };
719
728
  else {
@@ -739,9 +748,16 @@ async function mergeAllData(options = {}) {
739
748
  }
740
749
  } catch (err) {
741
750
  console.error(`Ortoni Report: Failed to parse shard ${file}:`, err);
751
+ badShards.push(file);
742
752
  continue;
743
753
  }
744
754
  }
755
+ if (badShards.length > 0) {
756
+ console.warn(
757
+ `Ortoni Report: Completed merge with ${badShards.length} bad shard(s) skipped:`,
758
+ badShards
759
+ );
760
+ }
745
761
  const totalDuration = totalDurationSum;
746
762
  const saveHistoryFromOptions = typeof options.saveHistory === "boolean" ? options.saveHistory : void 0;
747
763
  const saveHistoryFromShard = mergedUserConfig && typeof mergedUserConfig.saveHistory === "boolean" ? mergedUserConfig.saveHistory : void 0;
@@ -782,11 +798,12 @@ async function mergeAllData(options = {}) {
782
798
  dbManager
783
799
  );
784
800
  const finalReportData = await htmlGenerator.generateFinalReport(
785
- // filteredResults: keep same semantics (filter out skipped for display or pass as required)
801
+ // filteredResults: typically filter out skipped for display (keeps existing behavior)
786
802
  allResults.filter((r) => r.status !== "skipped"),
787
803
  totalDuration,
788
804
  allResults,
789
805
  projectSet
806
+ // pass Set<string> as original generateFinalReport expects
790
807
  );
791
808
  const fileManager = new FileManager(folderPath);
792
809
  const outputFileName = options.file || "ortoni-report.html";
@@ -794,12 +811,10 @@ async function mergeAllData(options = {}) {
794
811
  outputFileName,
795
812
  finalReportData
796
813
  );
797
- console.log(`\u2705 Final merged report generated at ${outputPath}`);
798
- console.log(
799
- `\u2705 Shards merged: ${sortedFiles.length}, total tests merged: ${allResults.length}`
800
- );
801
- console.log(`\u2705 totalDuration (sum of shards) = ${totalDuration}`);
802
- if (runId) console.log(`\u2705 DB runId: ${runId}`);
814
+ console.log(`\u2705 Final merged report generated at ${await outputPath}`);
815
+ console.log(`\u2705 Shards merged: ${sortedFiles.length}`);
816
+ console.log(`\u2705 Tests per shard:`, shardCounts);
817
+ console.log(`\u2705 Total tests merged ${allResults.length}`);
803
818
  }
804
819
 
805
820
  // src/utils/expressServer.ts
package/dist/cli.mjs CHANGED
@@ -44,6 +44,9 @@ async function mergeAllData(options = {}) {
44
44
  let totalDurationMax = 0;
45
45
  let mergedUserConfig = null;
46
46
  let mergedUserMeta = null;
47
+ const badShards = [];
48
+ const shardCounts = {};
49
+ const shardDurMap = {};
47
50
  for (const file of sortedFiles) {
48
51
  const fullPath = path.join(folderPath, file);
49
52
  try {
@@ -57,19 +60,25 @@ async function mergeAllData(options = {}) {
57
60
  continue;
58
61
  }
59
62
  shardData.results.forEach((r) => allResults.push(r));
63
+ shardCounts[file] = shardData.results.length;
60
64
  if (Array.isArray(shardData.projectSet)) {
61
65
  shardData.projectSet.forEach((p) => projectSet.add(p));
62
66
  }
63
- const shardDur = Number(shardData.duration);
67
+ const rawShardDur = shardData.duration;
64
68
  let durToAdd = 0;
65
- if (!isNaN(shardDur) && shardDur > 0) {
66
- durToAdd = shardDur;
69
+ let perTestSum = 0;
70
+ if (typeof rawShardDur === "number") {
71
+ durToAdd = rawShardDur;
67
72
  } else {
68
- const perTestSum = (Array.isArray(shardData.results) ? shardData.results : []).map((t) => Number(t.duration) || 0).reduce((a, b) => a + b, 0);
73
+ perTestSum = Array.isArray(shardData.results) ? shardData.results.reduce(
74
+ (acc, t) => acc + (Number(t?.duration) || 0),
75
+ 0
76
+ ) : 0;
69
77
  durToAdd = perTestSum;
70
78
  }
71
79
  totalDurationSum += durToAdd;
72
80
  if (durToAdd > totalDurationMax) totalDurationMax = durToAdd;
81
+ shardDurMap[file] = durToAdd;
73
82
  if (shardData.userConfig) {
74
83
  if (!mergedUserConfig) mergedUserConfig = { ...shardData.userConfig };
75
84
  else {
@@ -95,9 +104,16 @@ async function mergeAllData(options = {}) {
95
104
  }
96
105
  } catch (err) {
97
106
  console.error(`Ortoni Report: Failed to parse shard ${file}:`, err);
107
+ badShards.push(file);
98
108
  continue;
99
109
  }
100
110
  }
111
+ if (badShards.length > 0) {
112
+ console.warn(
113
+ `Ortoni Report: Completed merge with ${badShards.length} bad shard(s) skipped:`,
114
+ badShards
115
+ );
116
+ }
101
117
  const totalDuration = totalDurationSum;
102
118
  const saveHistoryFromOptions = typeof options.saveHistory === "boolean" ? options.saveHistory : void 0;
103
119
  const saveHistoryFromShard = mergedUserConfig && typeof mergedUserConfig.saveHistory === "boolean" ? mergedUserConfig.saveHistory : void 0;
@@ -138,11 +154,12 @@ async function mergeAllData(options = {}) {
138
154
  dbManager
139
155
  );
140
156
  const finalReportData = await htmlGenerator.generateFinalReport(
141
- // filteredResults: keep same semantics (filter out skipped for display or pass as required)
157
+ // filteredResults: typically filter out skipped for display (keeps existing behavior)
142
158
  allResults.filter((r) => r.status !== "skipped"),
143
159
  totalDuration,
144
160
  allResults,
145
161
  projectSet
162
+ // pass Set<string> as original generateFinalReport expects
146
163
  );
147
164
  const fileManager = new FileManager(folderPath);
148
165
  const outputFileName = options.file || "ortoni-report.html";
@@ -150,12 +167,10 @@ async function mergeAllData(options = {}) {
150
167
  outputFileName,
151
168
  finalReportData
152
169
  );
153
- console.log(`\u2705 Final merged report generated at ${outputPath}`);
154
- console.log(
155
- `\u2705 Shards merged: ${sortedFiles.length}, total tests merged: ${allResults.length}`
156
- );
157
- console.log(`\u2705 totalDuration (sum of shards) = ${totalDuration}`);
158
- if (runId) console.log(`\u2705 DB runId: ${runId}`);
170
+ console.log(`\u2705 Final merged report generated at ${await outputPath}`);
171
+ console.log(`\u2705 Shards merged: ${sortedFiles.length}`);
172
+ console.log(`\u2705 Tests per shard:`, shardCounts);
173
+ console.log(`\u2705 Total tests merged ${allResults.length}`);
159
174
  }
160
175
 
161
176
  // src/cli.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ortoni-report",
3
- "version": "4.1.0-test.0",
3
+ "version": "4.1.0-test.3",
4
4
  "description": "Playwright Report By LetCode with Koushik",
5
5
  "scripts": {
6
6
  "tsc": "tsc",