@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.
|
@@ -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
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
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-
|
|
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": [
|