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

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 +24 -11
  2. package/dist/cli.mjs +24 -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,17 +704,21 @@ 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
+ if (typeof rawShardDur === "number") {
714
+ durToAdd = rawShardDur;
711
715
  } else {
712
- const perTestSum = (Array.isArray(shardData.results) ? shardData.results : []).map((t) => Number(t.duration) || 0).reduce((a, b) => a + b, 0);
713
- durToAdd = perTestSum;
716
+ durToAdd = Array.isArray(shardData.results) ? shardData.results.reduce(
717
+ (acc, t) => acc + (Number(t?.duration) || 0),
718
+ 0
719
+ ) : 0;
714
720
  }
721
+ shardDurMap[file] = durToAdd;
715
722
  totalDurationSum += durToAdd;
716
723
  if (durToAdd > totalDurationMax) totalDurationMax = durToAdd;
717
724
  if (shardData.userConfig) {
@@ -739,9 +746,16 @@ async function mergeAllData(options = {}) {
739
746
  }
740
747
  } catch (err) {
741
748
  console.error(`Ortoni Report: Failed to parse shard ${file}:`, err);
749
+ badShards.push(file);
742
750
  continue;
743
751
  }
744
752
  }
753
+ if (badShards.length > 0) {
754
+ console.warn(
755
+ `Ortoni Report: Completed merge with ${badShards.length} bad shard(s) skipped:`,
756
+ badShards
757
+ );
758
+ }
745
759
  const totalDuration = totalDurationSum;
746
760
  const saveHistoryFromOptions = typeof options.saveHistory === "boolean" ? options.saveHistory : void 0;
747
761
  const saveHistoryFromShard = mergedUserConfig && typeof mergedUserConfig.saveHistory === "boolean" ? mergedUserConfig.saveHistory : void 0;
@@ -782,11 +796,12 @@ async function mergeAllData(options = {}) {
782
796
  dbManager
783
797
  );
784
798
  const finalReportData = await htmlGenerator.generateFinalReport(
785
- // filteredResults: keep same semantics (filter out skipped for display or pass as required)
799
+ // filteredResults: typically filter out skipped for display (keeps existing behavior)
786
800
  allResults.filter((r) => r.status !== "skipped"),
787
801
  totalDuration,
788
802
  allResults,
789
803
  projectSet
804
+ // pass Set<string> as original generateFinalReport expects
790
805
  );
791
806
  const fileManager = new FileManager(folderPath);
792
807
  const outputFileName = options.file || "ortoni-report.html";
@@ -795,11 +810,9 @@ async function mergeAllData(options = {}) {
795
810
  finalReportData
796
811
  );
797
812
  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}`);
813
+ console.log(`\u2705 Shards merged: ${sortedFiles.length}`);
814
+ console.log(`\u2705 Tests per shard:`, shardCounts);
815
+ console.log(`\u2705 Total tests merged ${allResults.length}`);
803
816
  }
804
817
 
805
818
  // 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,17 +60,21 @@ 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
+ if (typeof rawShardDur === "number") {
70
+ durToAdd = rawShardDur;
67
71
  } else {
68
- const perTestSum = (Array.isArray(shardData.results) ? shardData.results : []).map((t) => Number(t.duration) || 0).reduce((a, b) => a + b, 0);
69
- durToAdd = perTestSum;
72
+ durToAdd = Array.isArray(shardData.results) ? shardData.results.reduce(
73
+ (acc, t) => acc + (Number(t?.duration) || 0),
74
+ 0
75
+ ) : 0;
70
76
  }
77
+ shardDurMap[file] = durToAdd;
71
78
  totalDurationSum += durToAdd;
72
79
  if (durToAdd > totalDurationMax) totalDurationMax = durToAdd;
73
80
  if (shardData.userConfig) {
@@ -95,9 +102,16 @@ async function mergeAllData(options = {}) {
95
102
  }
96
103
  } catch (err) {
97
104
  console.error(`Ortoni Report: Failed to parse shard ${file}:`, err);
105
+ badShards.push(file);
98
106
  continue;
99
107
  }
100
108
  }
109
+ if (badShards.length > 0) {
110
+ console.warn(
111
+ `Ortoni Report: Completed merge with ${badShards.length} bad shard(s) skipped:`,
112
+ badShards
113
+ );
114
+ }
101
115
  const totalDuration = totalDurationSum;
102
116
  const saveHistoryFromOptions = typeof options.saveHistory === "boolean" ? options.saveHistory : void 0;
103
117
  const saveHistoryFromShard = mergedUserConfig && typeof mergedUserConfig.saveHistory === "boolean" ? mergedUserConfig.saveHistory : void 0;
@@ -138,11 +152,12 @@ async function mergeAllData(options = {}) {
138
152
  dbManager
139
153
  );
140
154
  const finalReportData = await htmlGenerator.generateFinalReport(
141
- // filteredResults: keep same semantics (filter out skipped for display or pass as required)
155
+ // filteredResults: typically filter out skipped for display (keeps existing behavior)
142
156
  allResults.filter((r) => r.status !== "skipped"),
143
157
  totalDuration,
144
158
  allResults,
145
159
  projectSet
160
+ // pass Set<string> as original generateFinalReport expects
146
161
  );
147
162
  const fileManager = new FileManager(folderPath);
148
163
  const outputFileName = options.file || "ortoni-report.html";
@@ -151,11 +166,9 @@ async function mergeAllData(options = {}) {
151
166
  finalReportData
152
167
  );
153
168
  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}`);
169
+ console.log(`\u2705 Shards merged: ${sortedFiles.length}`);
170
+ console.log(`\u2705 Tests per shard:`, shardCounts);
171
+ console.log(`\u2705 Total tests merged ${allResults.length}`);
159
172
  }
160
173
 
161
174
  // 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.1",
4
4
  "description": "Playwright Report By LetCode with Koushik",
5
5
  "scripts": {
6
6
  "tsc": "tsc",