@arghajit/dummy 0.1.0-beta-16 → 0.1.0-beta-17

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.
@@ -247,14 +247,24 @@ class PlaywrightPulseReporter {
247
247
  const uniqueTestId = test.id;
248
248
  // --- REFINED THIS SECTION for testData ---
249
249
  const maxWorkers = this.config.workers;
250
- // Use the modulo operator to map the unique workerIndex to a concurrency "slot".
251
- // This ensures workerId is always between 0 and (maxWorkers - 1).
252
- // Added a safeguard to fall back to the raw index if maxWorkers isn't a positive number.
253
- const mappedWorkerId = maxWorkers && maxWorkers > 0
254
- ? result.workerIndex % maxWorkers
255
- : result.workerIndex;
250
+ let mappedWorkerId;
251
+ // First, check for the special case where a test is not assigned a worker (e.g., global setup failure).
252
+ if (result.workerIndex === -1) {
253
+ mappedWorkerId = -1; // Keep it as -1 to clearly identify this special case.
254
+ }
255
+ else if (maxWorkers && maxWorkers > 0) {
256
+ // If there's a valid worker, map it to the concurrency slot...
257
+ const zeroBasedId = result.workerIndex % maxWorkers;
258
+ // ...and then shift it to be 1-based (1 to n).
259
+ mappedWorkerId = zeroBasedId + 1;
260
+ }
261
+ else {
262
+ // Fallback for when maxWorkers is not defined: just use the original index (and shift to 1-based).
263
+ mappedWorkerId = result.workerIndex + 1;
264
+ }
256
265
  const testSpecificData = {
257
266
  workerId: mappedWorkerId,
267
+ uniqueWorkerIndex: result.workerIndex, // We'll keep the original for diagnostics
258
268
  totalWorkers: maxWorkers,
259
269
  configFile: this.config.configFile,
260
270
  metadata: this.config.metadata
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-16",
4
+ "version": "0.1.0-beta-17",
5
5
  "description": "A Playwright reporter and dashboard for visualizing test results.",
6
6
  "keywords": [
7
7
  "playwright",