@arghajit/dummy 0.3.40 → 0.3.41
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.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arghajit/dummy",
|
|
3
3
|
"author": "Arghajit Singha",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.41",
|
|
5
5
|
"description": "A Playwright reporter and dashboard for visualizing test results.",
|
|
6
6
|
"homepage": "https://arghajit47.github.io/playwright-pulse/",
|
|
7
7
|
"repository": {
|
|
@@ -34,17 +34,34 @@ async function extractReporterOptionsFromConfig(configPath) {
|
|
|
34
34
|
|
|
35
35
|
// 1. Strategy: Text Parsing (Safe & Fast)
|
|
36
36
|
try {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
// Find the Pulse/Dummy reporter block
|
|
38
|
+
// It usually looks like ["@arghajit/playwright-pulse-report", { ... }] or ["playwright-pulse-report", { ... }]
|
|
39
|
+
const reporterBlockRegex = /\[\s*["'](?:@arghajit\/)?(?:playwright-pulse-report|dummy)["']\s*,\s*(\{[\s\S]*?\})\s*\]/g;
|
|
40
|
+
let match;
|
|
41
|
+
while ((match = reporterBlockRegex.exec(fileContent)) !== null) {
|
|
42
|
+
const block = match[1];
|
|
43
|
+
|
|
44
|
+
const outputDirMatch = block.match(/outputDir:\s*["']([^"']+)["']/);
|
|
45
|
+
if (outputDirMatch && outputDirMatch[1]) options.outputDir = outputDirMatch[1];
|
|
46
|
+
|
|
47
|
+
const outputFileMatch = block.match(/outputFile:\s*["']([^"']+)["']/);
|
|
48
|
+
if (outputFileMatch && outputFileMatch[1]) options.outputFile = outputFileMatch[1];
|
|
49
|
+
|
|
50
|
+
const resetOnEachRunMatch = block.match(/resetOnEachRun:\s*(true|false)/);
|
|
51
|
+
if (resetOnEachRunMatch) options.resetOnEachRun = resetOnEachRunMatch[1] === "true";
|
|
52
|
+
|
|
53
|
+
const individualReportsSubDirMatch = block.match(/individualReportsSubDir:\s*["']([^"']+)["']/);
|
|
54
|
+
if (individualReportsSubDirMatch && individualReportsSubDirMatch[1]) options.individualReportsSubDir = individualReportsSubDirMatch[1];
|
|
55
|
+
|
|
56
|
+
// If we found any Pulse-specific options, we're likely in the right block
|
|
57
|
+
if (Object.keys(options).length > 0) break;
|
|
58
|
+
}
|
|
45
59
|
|
|
46
|
-
|
|
47
|
-
if (
|
|
60
|
+
// Fallback for global outputDir if not found in reporter block
|
|
61
|
+
if (!options.outputDir) {
|
|
62
|
+
const globalOutputDirMatch = fileContent.match(/outputDir:\s*["']([^"']+)["']/);
|
|
63
|
+
if (globalOutputDirMatch && globalOutputDirMatch[1]) options.outputDir = globalOutputDirMatch[1];
|
|
64
|
+
}
|
|
48
65
|
} catch (e) { }
|
|
49
66
|
|
|
50
67
|
// 2. Safety Check and Dynamic Import
|
|
@@ -104,7 +121,8 @@ async function extractReporterOptionsFromConfig(configPath) {
|
|
|
104
121
|
|
|
105
122
|
if (typeof reporterName === "string" &&
|
|
106
123
|
(reporterName.includes("playwright-pulse-report") ||
|
|
107
|
-
reporterName.includes("@arghajit/playwright-pulse-report")
|
|
124
|
+
reporterName.includes("@arghajit/playwright-pulse-report") ||
|
|
125
|
+
reporterName.includes("@arghajit/dummy"))) {
|
|
108
126
|
if (reporterOptions) {
|
|
109
127
|
if (reporterOptions.outputDir) options.outputDir = reporterOptions.outputDir;
|
|
110
128
|
if (reporterOptions.outputFile) options.outputFile = reporterOptions.outputFile;
|
|
@@ -64,15 +64,24 @@ export async function mergeSequentialReportsIfNeeded(customOutputDir) {
|
|
|
64
64
|
const content = await fs.readFile(filePath, "utf-8");
|
|
65
65
|
const json = JSON.parse(content);
|
|
66
66
|
|
|
67
|
+
let currentRunId = `run-${Date.now()}-581d5ad8-ce75-4ca5-94a6-ed29c466c815`;
|
|
67
68
|
if (json.run) {
|
|
69
|
+
if (json.run.id) currentRunId = json.run.id;
|
|
70
|
+
|
|
68
71
|
const runTimestamp = new Date(json.run.timestamp);
|
|
69
72
|
if (runTimestamp > latestTimestamp) {
|
|
70
73
|
latestTimestamp = runTimestamp;
|
|
71
74
|
lastRunEnvironment = json.run.environment || undefined;
|
|
72
75
|
}
|
|
73
76
|
}
|
|
77
|
+
|
|
74
78
|
if (json.results) {
|
|
75
|
-
|
|
79
|
+
// Tag each result with its runId to ensure we can sum them up if they have same IDs but different runs
|
|
80
|
+
const resultsWithRunId = json.results.map((r) => ({
|
|
81
|
+
...r,
|
|
82
|
+
runId: currentRunId,
|
|
83
|
+
}));
|
|
84
|
+
allResultsFromAllFiles.push(...resultsWithRunId);
|
|
76
85
|
}
|
|
77
86
|
} catch (err) {
|
|
78
87
|
console.warn(
|
|
@@ -155,10 +164,12 @@ function getFinalizedResults(allResults) {
|
|
|
155
164
|
const resultsMap = new Map();
|
|
156
165
|
|
|
157
166
|
for (const result of allResults) {
|
|
158
|
-
|
|
159
|
-
|
|
167
|
+
// Unique key is runId + testId to support summation of tests across different sequential runs
|
|
168
|
+
const compositeId = `${result.runId || "unknown"}-${result.id}`;
|
|
169
|
+
if (!resultsMap.has(compositeId)) {
|
|
170
|
+
resultsMap.set(compositeId, []);
|
|
160
171
|
}
|
|
161
|
-
resultsMap.get(
|
|
172
|
+
resultsMap.get(compositeId).push(result);
|
|
162
173
|
}
|
|
163
174
|
|
|
164
175
|
const finalResults = [];
|