@arghajit/dummy 0.1.0-beta-21 → 0.1.0-beta-22

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.
@@ -26,5 +26,6 @@ export declare class PlaywrightPulseReporter implements Reporter {
26
26
  private _cleanupTemporaryFiles;
27
27
  private _ensureDirExists;
28
28
  onEnd(result: FullResult): Promise<void>;
29
+ private falseResetOnEachRun;
29
30
  }
30
31
  export default PlaywrightPulseReporter;
@@ -518,71 +518,73 @@ class PlaywrightPulseReporter {
518
518
  if (this.isSharded) {
519
519
  await this._cleanupTemporaryFiles();
520
520
  }
521
+ await this.falseResetOnEachRun();
521
522
  }
522
523
  }
523
524
  }
524
- }
525
- exports.PlaywrightPulseReporter = PlaywrightPulseReporter;
526
- function falseResetOnEachRun() {
527
- const REPORT_DIR = "./pulse-report"; // Or change this to your reports directory
528
- const OUTPUT_FILE = "playwright-pulse-report.json";
529
- function getReportFiles(dir) {
530
- return fsSync
531
- .readdirSync(dir)
532
- .filter((file) => file.startsWith("playwright-pulse-report-") && file.endsWith(".json"));
533
- }
534
- function mergeReports(files) {
535
- var _a;
536
- let combinedRun = {
537
- totalTests: 0,
538
- passed: 0,
539
- failed: 0,
540
- skipped: 0,
541
- duration: 0,
542
- environment: {},
543
- };
544
- let combinedResults = [];
545
- let latestTimestamp = "";
546
- let latestGeneratedAt = "";
547
- for (const file of files) {
548
- const filePath = path.join(`${REPORT_DIR}/pulse-results`, file);
549
- const json = JSON.parse(fsSync.readFileSync(filePath, "utf-8"));
550
- const run = json.run || {};
551
- combinedRun.totalTests += run.totalTests || 0;
552
- combinedRun.passed += run.passed || 0;
553
- combinedRun.failed += run.failed || 0;
554
- combinedRun.skipped += run.skipped || 0;
555
- combinedRun.duration += run.duration || 0;
556
- combinedRun.environment = run.environment || {};
557
- if (json.results) {
558
- combinedResults.push(...json.results);
525
+ async falseResetOnEachRun() {
526
+ const REPORT_DIR = "./pulse-report"; // Or change this to your reports directory
527
+ const OUTPUT_FILE = "playwright-pulse-report.json";
528
+ function getReportFiles(dir) {
529
+ return fsSync
530
+ .readdirSync(dir)
531
+ .filter((file) => file.startsWith("playwright-pulse-report-") &&
532
+ file.endsWith(".json"));
533
+ }
534
+ function mergeReports(files) {
535
+ var _a;
536
+ let combinedRun = {
537
+ totalTests: 0,
538
+ passed: 0,
539
+ failed: 0,
540
+ skipped: 0,
541
+ duration: 0,
542
+ environment: {},
543
+ };
544
+ let combinedResults = [];
545
+ let latestTimestamp = "";
546
+ let latestGeneratedAt = "";
547
+ for (const file of files) {
548
+ const filePath = path.join(`${REPORT_DIR}/pulse-results`, file);
549
+ const json = JSON.parse(fsSync.readFileSync(filePath, "utf-8"));
550
+ const run = json.run || {};
551
+ combinedRun.totalTests += run.totalTests || 0;
552
+ combinedRun.passed += run.passed || 0;
553
+ combinedRun.failed += run.failed || 0;
554
+ combinedRun.skipped += run.skipped || 0;
555
+ combinedRun.duration += run.duration || 0;
556
+ combinedRun.environment = run.environment || {};
557
+ if (json.results) {
558
+ combinedResults.push(...json.results);
559
+ }
560
+ if (run.timestamp > latestTimestamp)
561
+ latestTimestamp = run.timestamp;
562
+ if (((_a = json.metadata) === null || _a === void 0 ? void 0 : _a.generatedAt) > latestGeneratedAt)
563
+ latestGeneratedAt = json.metadata.generatedAt;
559
564
  }
560
- if (run.timestamp > latestTimestamp)
561
- latestTimestamp = run.timestamp;
562
- if (((_a = json.metadata) === null || _a === void 0 ? void 0 : _a.generatedAt) > latestGeneratedAt)
563
- latestGeneratedAt = json.metadata.generatedAt;
565
+ const finalJson = {
566
+ run: {
567
+ id: `merged-${Date.now()}`,
568
+ timestamp: latestTimestamp,
569
+ ...combinedRun,
570
+ },
571
+ results: combinedResults,
572
+ metadata: {
573
+ generatedAt: latestGeneratedAt,
574
+ },
575
+ };
576
+ return finalJson;
564
577
  }
565
- const finalJson = {
566
- run: {
567
- id: `merged-${Date.now()}`,
568
- timestamp: latestTimestamp,
569
- ...combinedRun,
570
- },
571
- results: combinedResults,
572
- metadata: {
573
- generatedAt: latestGeneratedAt,
574
- },
575
- };
576
- return finalJson;
577
- }
578
- // Main execution
579
- const reportFiles = getReportFiles(REPORT_DIR);
580
- if (reportFiles.length === 0) {
581
- console.log("No matching JSON report files found.");
582
- process.exit(1);
578
+ // Main execution
579
+ const reportFiles = getReportFiles(REPORT_DIR);
580
+ if (reportFiles.length === 0) {
581
+ console.log("No matching JSON report files found.");
582
+ process.exit(1);
583
+ }
584
+ const merged = mergeReports(reportFiles);
585
+ fsSync.writeFileSync(path.join(REPORT_DIR, OUTPUT_FILE), JSON.stringify(merged, null, 2));
586
+ console.log(`✅ Merged report saved as ${OUTPUT_FILE}`);
583
587
  }
584
- const merged = mergeReports(reportFiles);
585
- fsSync.writeFileSync(path.join(REPORT_DIR, OUTPUT_FILE), JSON.stringify(merged, null, 2));
586
- console.log(`✅ Merged report saved as ${OUTPUT_FILE}`);
587
588
  }
589
+ exports.PlaywrightPulseReporter = PlaywrightPulseReporter;
588
590
  exports.default = PlaywrightPulseReporter;
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-21",
4
+ "version": "0.1.0-beta-22",
5
5
  "description": "A Playwright reporter and dashboard for visualizing test results.",
6
6
  "homepage": "https://playwright-pulse-report.netlify.app/",
7
7
  "keywords": [