@arghajit/dummy 0.1.0-beta-24 → 0.1.0-beta-25

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.
@@ -512,47 +512,48 @@ class PlaywrightPulseReporter {
512
512
  }
513
513
  return;
514
514
  }
515
- const combinedRun = {
516
- id: `merged-${Date.now()}`,
517
- timestamp: new Date(0),
518
- totalTests: 0,
519
- passed: 0,
520
- failed: 0,
521
- skipped: 0,
522
- duration: 0,
523
- environment: undefined,
524
- };
525
- const allResults = [];
515
+ const allResultsFromAllFiles = [];
526
516
  let latestTimestamp = new Date(0);
517
+ let lastRunEnvironment = undefined;
518
+ let totalDuration = 0;
527
519
  for (const file of reportFiles) {
528
520
  const filePath = path.join(pulseResultsDir, file);
529
521
  try {
530
522
  const content = await fs.readFile(filePath, "utf-8");
531
523
  const json = JSON.parse(content);
532
524
  if (json.run) {
533
- combinedRun.totalTests += json.run.totalTests || 0;
534
- combinedRun.passed += json.run.passed || 0;
535
- combinedRun.failed += json.run.failed || 0;
536
- combinedRun.skipped += json.run.skipped || 0;
537
- combinedRun.duration += json.run.duration || 0;
538
525
  const runTimestamp = new Date(json.run.timestamp);
539
526
  if (runTimestamp > latestTimestamp) {
540
527
  latestTimestamp = runTimestamp;
541
- combinedRun.environment = json.run.environment || undefined;
528
+ lastRunEnvironment = json.run.environment || undefined;
542
529
  }
543
530
  }
544
531
  if (json.results) {
545
- allResults.push(...json.results);
532
+ allResultsFromAllFiles.push(...json.results);
546
533
  }
547
534
  }
548
535
  catch (err) {
549
536
  console.warn(`Pulse Reporter: Could not parse report file ${filePath}. Skipping. Error: ${err.message}`);
550
537
  }
551
538
  }
552
- combinedRun.timestamp = latestTimestamp;
539
+ // De-duplicate the results from ALL merged files using the helper function
540
+ const finalMergedResults = this._getFinalizedResults(allResultsFromAllFiles);
541
+ // Sum the duration from the final, de-duplicated list of tests
542
+ totalDuration = finalMergedResults.reduce((acc, r) => acc + (r.duration || 0), 0);
543
+ const combinedRun = {
544
+ id: `merged-${Date.now()}`,
545
+ timestamp: latestTimestamp,
546
+ environment: lastRunEnvironment,
547
+ // Recalculate counts based on the truly final, de-duplicated list
548
+ totalTests: finalMergedResults.length,
549
+ passed: finalMergedResults.filter((r) => r.status === "passed").length,
550
+ failed: finalMergedResults.filter((r) => r.status === "failed").length,
551
+ skipped: finalMergedResults.filter((r) => r.status === "skipped").length,
552
+ duration: totalDuration,
553
+ };
553
554
  const finalReport = {
554
555
  run: combinedRun,
555
- results: allResults,
556
+ results: finalMergedResults, // Use the de-duplicated list
556
557
  metadata: {
557
558
  generatedAt: new Date().toISOString(),
558
559
  },
@@ -564,7 +565,7 @@ class PlaywrightPulseReporter {
564
565
  return value;
565
566
  }, 2));
566
567
  if (this.printsToStdio()) {
567
- console.log(`PlaywrightPulseReporter: ✅ Merged report with ${allResults.length} total results saved to ${finalOutputPath}`);
568
+ console.log(`PlaywrightPulseReporter: ✅ Merged report with ${finalMergedResults.length} total results saved to ${finalOutputPath}`);
568
569
  }
569
570
  }
570
571
  catch (err) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arghajit/dummy",
3
3
  "author": "Arghajit Singha",
4
- "version": "0.1.0-beta-24",
4
+ "version": "0.1.0-beta-25",
5
5
  "description": "A Playwright reporter and dashboard for visualizing test results.",
6
6
  "homepage": "https://playwright-pulse-report.netlify.app/",
7
7
  "keywords": [