reporting-labs 0.6.13 → 0.6.14

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/README.md CHANGED
@@ -121,27 +121,47 @@ One line per test. With this the report can rank failures by priority, group the
121
121
  - Forgot one? After every run the console lists the tests that have no `meta()`, with file and line. Turn it off with `warnMissingMeta: false`.
122
122
  - `priority`, `severity`, `feature` and `owner` each get a tab in the Breakdown chart and a filter on the Tests page. Want the same for your own key, say `meta({ team: 'web' })`? Add it to `dimensions` in the config: `dimensions: ['priority', 'severity', 'feature', 'owner', 'team']`.
123
123
 
124
- ### Or write it as a comment (no code change)
124
+ ### Or write it as a comment (your choice)
125
125
 
126
- `meta()` stays the main way. If your team prefers not to add calls to the tests, the same meta can sit in a comment right above the test or `test.describe`:
126
+ There are **two ways** to add meta. Both give **exactly the same report**, so use whichever you like:
127
+
128
+ | | Way 1: `meta()` | Way 2: a comment |
129
+ |---|---|---|
130
+ | Where | one line inside the test | a comment right above the test |
131
+ | Import needed | yes | no |
127
132
 
128
133
  ```ts
134
+ // Way 1: meta() in the test
135
+ test('completes purchase', async ({ page }) => {
136
+ meta({ priority: 'P0', owner: 'naveen', feature: 'payment', story: 'SHOP-250' });
137
+ // ... your test as usual
138
+ });
139
+
140
+ // Way 2: a comment above the test, no import, no code change
129
141
  /**
130
- * Completes a purchase with a saved card.
131
142
  * @priority P0 @owner naveen @feature payment @story SHOP-250
132
143
  * @smoke
133
144
  */
134
145
  test('completes purchase', async ({ page }) => {
135
- // ... your test as usual, no meta() needed
146
+ // ... your test as usual
136
147
  });
137
148
  ```
138
149
 
139
- - `@key value` pairs become meta (known keys, plus keys in `dimensions` or `links`). A line of bare `@words` (` * @smoke @regression`) becomes tags, so `@P0` and `@critical` still set priority and severity; a mention inside a sentence ("reported by @naveen") is ignored.
140
- - A comment above `test.describe` applies to every test inside; the test's own comment wins over it.
141
- - If a test has both, **`meta()` wins** over the comment.
142
- - Only a comment touching the test counts: a file header separated by a blank line is ignored, and so are JSDoc tags like `@param`.
143
- - Works with the WebdriverIO reporter too (above `it()` / `describe()`). Turn it off with `commentMeta: false`.
144
- - **Snippets:** `npx reporting-labs snippets` adds VS Code snippets, so you type `rlmeta` (or `rltest`, `rlit`, `rldescribe`) and press Tab instead of writing the comment by hand. `init` adds them too.
150
+ - **Already using `meta()`?** Nothing changes. Comments are only an extra option.
151
+ - **Mix them freely.** Some tests with `meta()`, others with a comment. If one test has both, `meta()` wins.
152
+ - **For a whole group:** a comment above `test.describe` applies to every test inside it.
153
+ - **Tags:** a line with only `@words` (`@smoke @regression`) becomes tags. `@P0` sets the priority, `@critical` the severity.
154
+ - **Your old comments are safe.** A comment with an empty line before the test, a name in a sentence ("reported by @naveen"), unknown keys and JSDoc tags like `@param` are all ignored.
155
+ - **WebdriverIO** reads them too, above `it()` and `describe()`.
156
+ - Turn it off with `commentMeta: false`.
157
+
158
+ **Don't type it by hand: install the snippets.** In VS Code:
159
+
160
+ 1. In the project folder, run `npx reporting-labs snippets` (`npx reporting-labs init` already does this). It creates `.vscode/reporting-labs.code-snippets`.
161
+ 2. In a test file, type `rlmeta` and press **Tab**. The comment appears; pick the priority from the list, then **Tab** to the next field.
162
+ 3. Commit the `.vscode` file so the whole team gets the snippets.
163
+
164
+ Also there: `rltest` (comment + `test()`), `rlit` (comment + `it()`), `rldescribe` (a `describe` with the comment). For IntelliJ / WebStorm and Eclipse, see [Install the editor snippets](https://reportinglabs.dev/features/meta-comments#install-the-editor-snippets).
145
165
 
146
166
  ### `log()`: a line in the report
147
167
 
@@ -164,7 +184,34 @@ await testData(rowsFromExcelOrJson, 'Coupons'); // arr
164
184
  await testData(fs.readFileSync('data/users.csv', 'utf8'), 'users.csv'); // CSV text → table
165
185
  ```
166
186
 
167
- **Secrets are masked automatically**, wherever they show up: `console.log` output, `log()` lines, `testData()` blocks, API headers and bodies, step titles and assertion messages. Covered forms: `password=x`, `Password: x`, `{ password: 'x' }`, `"password":"x"`, `X-Api-Key: x`, `access_token=x`, "password is x", "with password S3cret@1", `Bearer ...` / `Basic ...`, JWTs, and well-known token formats (GitHub, AWS, Slack, Stripe, Google, GitLab, npm, SendGrid). A failing `expect(token)` shows `Received: "****"`. Also `user:pass@host` in URLs, `curl -u user:pass`, `credentials user:pass`, `password for user X is Y`, `Typed x into password field`, and Luhn-valid card numbers. The masker remembers every value it has masked (and the values of `PASSWORD` / `API_TOKEN` / `*_SECRET` environment variables), so a secret that later appears with no key at all (`Logging in as admin / s3cret`) is blanked too. Add your own keys with `maskKeys: ['otp', 'pan']` and values it cannot know about with `maskValues: [process.env.PASSWORD]`; `maskFromEnv: false` turns the environment learning off.
187
+ ### Secrets are masked automatically
188
+
189
+ Passwords, tokens and card numbers never reach the report. They are replaced with `****` **before** anything is written, with no setup.
190
+
191
+ **Where:** `console.log` output, `log()` lines, `testData()` blocks, API headers and bodies, step titles and failed assertions (a failing `expect(token)` shows `Received: "****"`).
192
+
193
+ **What it catches:**
194
+
195
+ | Kind | Examples |
196
+ |---|---|
197
+ | Key and value | `password=x`, `Password: x`, `{ password: 'x' }`, `"password":"x"`, `access_token=x`, `X-Api-Key: x` |
198
+ | Plain sentences | "password is x", "with password S3cret@1", "password for user X is Y", "Typed x into password field" |
199
+ | Login in a URL or command | `user:pass@host`, `curl -u user:pass`, `credentials user:pass` |
200
+ | Auth headers | `Bearer …`, `Basic …` |
201
+ | Tokens | JWTs, and GitHub, AWS, Slack, Stripe, Google, GitLab, npm and SendGrid keys |
202
+ | Card numbers | any valid card number (Luhn check) |
203
+
204
+ **It remembers.** Once a value has been masked, it is masked everywhere it shows up later, even with no key around it: `Logging in as admin / s3cret` becomes `Logging in as admin / ****`. It also learns the values of environment variables like `PASSWORD`, `API_TOKEN` or `*_SECRET`.
205
+
206
+ **Add your own:**
207
+
208
+ ```ts
209
+ reporter: [['reporting-labs', {
210
+ maskKeys: ['otp', 'pan'], // extra key names to mask
211
+ maskValues: [process.env.PASSWORD], // exact values to mask wherever they appear
212
+ // maskFromEnv: false, // stop learning values from environment variables
213
+ }]]
214
+ ```
168
215
 
169
216
  ## API calls: recorded on their own
170
217
 
@@ -290,37 +337,40 @@ Every outcome Playwright can produce, not just pass and fail:
290
337
 
291
338
  ## How it compares
292
339
 
293
- Legend: ✅ built in · 🟡 possible with manual setup or extra config · ❌ not in the official docs
340
+ ✅ built in · 🟡 possible with extra setup · ❌ not in the official docs
294
341
 
295
- | Feature | Playwright HTML | Allure | reportingLabs |
342
+ | | Playwright HTML | Allure | **reportingLabs** |
296
343
  |---|:---:|:---:|:---:|
297
- | Single HTML file, opens without a server | ❌ folder, served by `show-report` | 🟡 single-file mode (2.24+, Allure 3 plugin), otherwise `allure open` | ✅ |
298
- | No extra tooling | ✅ | ❌ CLI needed; Allure 2 needs Java | ✅ npm package only |
299
- | Setup | ✅ built in | 🟡 reporter + generate step | ✅ one line in `reporter:` |
344
+ | **Getting started** | | | |
345
+ | Single HTML file, opens without a server | ❌<br><sub>a folder, served by `show-report`</sub> | 🟡<br><sub>single-file mode (2.24+, Allure 3)</sub> | ✅ |
346
+ | Nothing extra to install | ✅ | ❌<br><sub>Allure CLI; Allure 2 needs Java</sub> | ✅<br><sub>one package</sub> |
347
+ | Setup | ✅<br><sub>built in</sub> | 🟡<br><sub>reporter + generate step</sub> | ✅<br><sub>one line</sub> |
348
+ | Frameworks | ❌<br><sub>Playwright only</sub> | ✅<br><sub>many languages</sub> | ✅<br><sub>Playwright, WebdriverIO, pytest, Robot, JUnit 5, TestNG, Cucumber</sub> |
349
+ | **Each test** | | | |
300
350
  | Steps, screenshots, videos, traces | ✅ | ✅ | ✅ |
301
- | Visual comparison viewer (slider, side by side, diff) | ❌ | ❌ | ✅ |
302
- | Tags and annotations shown | ✅ | ✅ labels via runtime API | ✅ `meta()` + tags |
303
- | Priority / severity / owner / feature / epic / story | 🟡 custom annotations | ✅ labels | ✅ |
304
- | Links to Jira, TMS | 🟡 annotation with a URL | ✅ `issue()`, `tms()` | ✅ `links` templates |
305
- | Failures ranked by priority and severity | ❌ | ❌ | ✅ Needs attention |
306
- | Failures by owner | ❌ | 🟡 owner label, no rollup documented | ✅ |
307
- | History across runs | ❌ | 🟡 History Trend when historical data is accumulated | ✅ history file, zero setup |
308
- | New vs known failures ("failing since #1840") | ❌ | ❌ | ✅ |
309
- | Flaky detection | ✅ `flaky` outcome per run | 🟡 `@Flaky` annotation (Java) | ✅ outcome + flakiest over last runs |
310
- | Got slower vs last run | ❌ | ❌ | ✅ |
311
- | Trend chart | ❌ | ✅ | ✅ |
312
- | Failures grouped by root cause | ❌ | 🟡 `categories.json` with regex | ✅ automatic clusters |
313
- | Failures explained in plain words | ❌ | ❌ | ✅ 18 kinds |
314
- | Bug report in one click | ❌ | ❌ | ✅ Markdown, Jira, text |
315
- | Environment info | ❌ | 🟡 `environment.properties` | ✅ automatic + `env` option |
316
- | API calls with request/response | ❌ | 🟡 manual attachments | ✅ automatic, Copy as cURL |
317
- | Logs and test data blocks | 🟡 attachments | 🟡 attachments, parameters | ✅ `log()`, `testData()` |
318
- | Secrets masked | ❌ | 🟡 parameter masking | ✅ automatic |
319
- | CSV / JSON export of failures, Slack summary | ❌ | ❌ | ✅ |
351
+ | Logs and test data | 🟡<br><sub>as attachments</sub> | 🟡<br><sub>attachments, parameters</sub> | ✅<br><sub>`log()`, `testData()`</sub> |
352
+ | API calls with request and response | ❌ | 🟡<br><sub>manual attachments</sub> | ✅<br><sub>automatic, Copy as cURL</sub> |
353
+ | Environment info | ❌ | 🟡<br><sub>`environment.properties`</sub> | ✅<br><sub>automatic</sub> |
354
+ | Secrets masked | ❌ | 🟡<br><sub>parameters only</sub> | ✅<br><sub>automatic</sub> |
355
+ | **Failures** | | | |
356
+ | Ranked by priority and severity | ❌ | ❌ | ✅<br><sub>Needs attention</sub> |
357
+ | Grouped by root cause | ❌ | 🟡<br><sub>regex in `categories.json`</sub> | ✅<br><sub>automatic clusters</sub> |
358
+ | Explained in plain words | ❌ | ❌ | ✅<br><sub>19 kinds</sub> |
359
+ | New vs already failing | ❌ | ❌ | ✅<br><sub>"failing since #1840"</sub> |
360
+ | Grouped by owner | ❌ | 🟡<br><sub>owner label, no rollup</sub> | ✅ |
361
+ | Bug report in one click | ❌ | ❌ | ✅<br><sub>Markdown, Jira, text</sub> |
362
+ | **Across runs** | | | |
363
+ | History and trend chart | ❌ | 🟡<br><sub>when history is carried over</sub> | ✅<br><sub>zero setup</sub> |
364
+ | Flaky tests | ✅<br><sub>per run</sub> | 🟡<br><sub>`@Flaky` (Java)</sub> | ✅<br><sub>plus flakiest over runs</sub> |
365
+ | Got slower than last run | ❌ | ❌ | ✅ |
320
366
  | Timeline by worker | ❌ | ✅ | ✅ |
321
- | Combine shards / several runs | ✅ blob + `merge-reports` | ✅ Launches | ✅ `reporting-labs merge` |
322
- | Frameworks beyond Playwright | ❌ | ✅ many languages | ❌ on the roadmap |
323
- | Free and open source | ✅ | ✅ (Allure TestOps is a separate paid product) | ✅ MIT |
367
+ | **Organise and share** | | | |
368
+ | Priority, owner, feature, story | 🟡<br><sub>custom annotations</sub> | ✅<br><sub>labels</sub> | ✅<br><sub>`meta()` or a comment</sub> |
369
+ | Links to Jira or a TMS | 🟡<br><sub>URL in an annotation</sub> | ✅<br><sub>`issue()`, `tms()`</sub> | ✅<br><sub>`links` templates</sub> |
370
+ | Merge shards or several runs | ✅<br><sub>`merge-reports`</sub> | ✅<br><sub>launches</sub> | ✅<br><sub>`reporting-labs merge`</sub> |
371
+ | PDF of the report | ❌ | ❌ | ✅<br><sub>`report.pdf`</sub> |
372
+ | CSV / JSON export, Slack summary | ❌ | 🟡<br><sub>Allure 3 plugins</sub> | ✅ |
373
+ | Free and open source | ✅ | ✅<br><sub>TestOps is paid</sub> | ✅<br><sub>MIT</sub> |
324
374
 
325
375
  Based on the official docs as of September 2026. ❌ means the feature is not described in the tool's documentation, not that it is impossible. Sources: Playwright [reporters](https://github.com/microsoft/playwright/blob/main/docs/src/test-reporters-js.md), [annotations](https://github.com/microsoft/playwright/blob/main/docs/src/test-annotations-js.md), [retries](https://github.com/microsoft/playwright/blob/main/docs/src/test-retries-js.md), [sharding](https://github.com/microsoft/playwright/blob/main/docs/src/test-sharding-js.md), [trace viewer](https://github.com/microsoft/playwright/blob/main/docs/src/trace-viewer-intro-js.md); Allure [allure-playwright](https://github.com/allure-framework/allure-js/blob/main/packages/allure-playwright/README.md), [Allure 3](https://github.com/allure-framework/allure3), [Allure 2.24.0 release](https://github.com/allure-framework/allure2/releases/tag/2.24.0), [Allure docs: command line](https://github.com/allure-framework/allure-docs/blob/main/content/reporting/commandline.md), [features](https://github.com/allure-framework/allure-docs/blob/main/content/gettingstarted/features.md), [report structure](https://github.com/allure-framework/allure-docs/blob/main/content/gettingstarted/report-structure.md). If something here is out of date, open an issue and it will be fixed.
326
376
 
@@ -362,9 +412,10 @@ Every option is optional. `npx reporting-labs init` writes them all, with commen
362
412
  | `embedFonts` | `true` | Bundle the fonts (~140 KB) so it looks the same offline |
363
413
  | `announce` | `true` | Print the report path after the run |
364
414
  | `open` | `'on-failure'` | Open the report in the browser after the run: `'on-failure'`, `'always'` or `'never'`. Never opens in CI |
365
- | `warnMissingMeta` | `true` | After the run, list the tests that have no `meta()` in the console, so nobody on the team forgets |
415
+ | `commentMeta` | `true` | Also read meta from the comment above a test or `describe` (`/** @priority P0 @owner naveen */`). `meta()` wins when both are there. `false` reads no comments |
416
+ | `warnMissingMeta` | `true` | After the run, list the tests that have no meta (no `meta()` and no comment) in the console, so nobody on the team forgets |
366
417
 
367
- **Runtime overrides.** `REPORTING_LABS_METADATA_<KEY>` sets a header chip from the environment (`REPORTING_LABS_METADATA_ENV=qa`, `REPORTING_LABS_METADATA_RELEASE=2.3`) and `REPORTING_LABS_TITLE`, `_THEME`, `_PALETTE`, `_ACCENT`, `_LOGO` the matching option; they win over the config. The env chip resolves in this order: `REPORTING_LABS_METADATA_ENV`, the variable `envVar` names, the conventional names (`ENV`, `TEST_ENV`, `APP_ENV`, `TARGET_ENV`, `CI_ENVIRONMENT_NAME`, anything ending in `_ENV`), then `metadata.env` in the config.
418
+ **Runtime overrides.** `REPORTING_LABS_METADATA_<KEY>` sets a header chip from the environment (`REPORTING_LABS_METADATA_ENV=qa`, `REPORTING_LABS_METADATA_RELEASE=2.3`) and `REPORTING_LABS_TITLE`, `_THEME`, `_PALETTE`, `_ACCENT`, `_LOGO`, `_OUTPUT_FOLDER` the matching option; they win over the config. The env chip resolves in this order: `REPORTING_LABS_METADATA_ENV`, the variable `envVar` names, the conventional names (`ENV`, `TEST_ENV`, `APP_ENV`, `TARGET_ENV`, `CI_ENVIRONMENT_NAME`, anything ending in `_ENV`), then `metadata.env` in the config.
368
419
 
369
420
  If your reporter list differs between CI and local, add the same line to both:
370
421
 
@@ -424,10 +475,11 @@ Three shards, run one after another (on a single machine you cannot really run t
424
475
  rm -rf all-shards merged
425
476
 
426
477
  # Run each shard and move its folder aside so the next shard does not overwrite it
478
+ # (use ; not &&: a shard with a failing test exits 1, and && would skip its mv)
427
479
  mkdir -p all-shards
428
- npx playwright test --shard=1/3 && mv reporting-labs all-shards/s1
429
- npx playwright test --shard=2/3 && mv reporting-labs all-shards/s2
430
- npx playwright test --shard=3/3 && mv reporting-labs all-shards/s3
480
+ npx playwright test --shard=1/3; mv reporting-labs all-shards/s1
481
+ npx playwright test --shard=2/3; mv reporting-labs all-shards/s2
482
+ npx playwright test --shard=3/3; mv reporting-labs all-shards/s3
431
483
 
432
484
  # One command combines them
433
485
  npx reporting-labs merge all-shards -o merged
@@ -452,18 +504,20 @@ That line proves the reporter ran and the folder exists to move. If you do not s
452
504
  mv my-report all-shards/s1
453
505
  ```
454
506
 
455
- **One-liner for a real parallel run on your laptop.** Runs three shards at once, then merges when all three finish:
507
+ **A real parallel run on your laptop.** Runs three shards at once, then merges when all three finish. Shards that run at the same time in one folder need their own folders, or they overwrite each other: `REPORTING_LABS_OUTPUT_FOLDER` gives each shard its own report folder, and `--output` gives each its own Playwright `test-results`:
456
508
 
457
509
  ```bash
458
510
  rm -rf all-shards merged && mkdir -p all-shards
459
- (npx playwright test --shard=1/3 && mv reporting-labs all-shards/s1) &
460
- (npx playwright test --shard=2/3 && mv reporting-labs all-shards/s2) &
461
- (npx playwright test --shard=3/3 && mv reporting-labs all-shards/s3) &
511
+ REPORTING_LABS_OUTPUT_FOLDER=all-shards/s1 npx playwright test --shard=1/3 --output=test-results/s1 &
512
+ REPORTING_LABS_OUTPUT_FOLDER=all-shards/s2 npx playwright test --shard=2/3 --output=test-results/s2 &
513
+ REPORTING_LABS_OUTPUT_FOLDER=all-shards/s3 npx playwright test --shard=3/3 --output=test-results/s3 &
462
514
  wait
463
515
  npx reporting-labs merge all-shards -o merged
464
516
  open merged/index.html
465
517
  ```
466
518
 
519
+ In the merged report the Timeline gives every shard's workers their own rows (`S1·w0`, `S1·w1`, `S2·w0` …), the Workers card says `3 shards × 3 workers`, and the wall clock runs from the first shard's start to the last shard's end.
520
+
467
521
  #### GitHub Actions
468
522
 
469
523
  Each shard runs on its own runner in parallel, then a final `merge` job downloads every shard's report and combines them. Copy-paste as `.github/workflows/tests.yml` in your repo:
package/bin/merge.js CHANGED
@@ -95,25 +95,43 @@ function merge(inputs, opts) {
95
95
 
96
96
  const shards = dirs.map((d, i) => {
97
97
  const data = JSON.parse(fs.readFileSync(path.join(d, 'report.json'), 'utf8'));
98
- return { dir: d, label: shardLabel(d, i, data), data };
98
+ return { dir: d, label: shardLabel(d, i, data), data, order: data.shard && data.shard.current ? data.shard.current : 1e6 + i };
99
+ }).sort((a, b) => a.order - b.order);
100
+
101
+ // Every shard numbers its workers from 0. Give each shard its own lanes (S1·w0, S1·w1, S2·w0, ...) so the
102
+ // Timeline and Workers cards do not stack four shards onto the same rows.
103
+ let offset = 0;
104
+ const workerLabels = [];
105
+ const shardInfo = shards.map((s, i) => {
106
+ const n = s.data.shard && s.data.shard.current ? s.data.shard.current : i + 1;
107
+ const w = Math.max(s.data.workers || 0, 1 + Math.max(-1, ...(s.data.tests || []).flatMap(t => (t.results || []).map(r => r.workerIndex ?? -1))));
108
+ s.offset = offset; offset += w;
109
+ for (let k = 0; k < w; k++) workerLabels.push(`S${n}·w${k}`);
110
+ return { shard: n, workers: w, startTime: s.data.startTime || 0, duration: s.data.duration || 0 };
99
111
  });
112
+ const start = Math.min(...shards.map(s => s.data.startTime || 0));
113
+ const end = Math.max(...shards.map(s => (s.data.startTime || 0) + (s.data.duration || 0)));
100
114
 
101
115
  const first = shards[0].data;
102
116
  // Compose combined data. Start from the first shard's options/env, then merge in test rows.
103
117
  const combined = {
104
118
  ...first,
105
119
  title: opts.title || first.title,
106
- startTime: Math.min(...shards.map(s => s.data.startTime || 0)),
107
- duration: Math.max(...shards.map(s => s.data.duration || 0)),
120
+ startTime: start,
121
+ duration: end - start, // wall clock from the first shard's start to the last shard's end
108
122
  generatedAt: Date.now(),
109
123
  stats: { passed: 0, failed: 0, skipped: 0, flaky: 0, timedOut: 0, interrupted: 0, total: 0 },
110
124
  tests: [],
111
125
  globalErrors: [],
112
126
  globalOutput: [],
113
127
  projects: [],
114
- workers: shards.reduce((n, s) => n + (s.data.workers || 0), 0),
128
+ workers: offset,
129
+ // one folder: keep the plain w0, w1 ... lanes of a normal run
130
+ workerLabels: shards.length > 1 ? workerLabels : undefined,
131
+ shardInfo: shards.length > 1 ? shardInfo : undefined,
115
132
  shard: undefined, // no longer sharded
116
- env: [...(first.env || [])],
133
+ // the first shard's own "Shard 1 of 4" / "Workers 4" rows would be wrong for the merged run
134
+ env: (first.env || []).filter(e => e.k !== 'Shard' && e.k !== 'Workers'),
117
135
  history: first.history || [], // all shards share the same history file
118
136
  };
119
137
 
@@ -128,6 +146,7 @@ function merge(inputs, opts) {
128
146
  ...t,
129
147
  results: (t.results || []).map(r => ({
130
148
  ...r,
149
+ workerIndex: typeof r.workerIndex === 'number' && r.workerIndex >= 0 ? r.workerIndex + s.offset : r.workerIndex,
131
150
  attachments: (r.attachments || []).map(a => rewriteAttachmentPath(a, s.label)),
132
151
  })),
133
152
  };
@@ -137,6 +156,8 @@ function merge(inputs, opts) {
137
156
  for (const o of (s.data.globalOutput || [])) combined.globalOutput.push(o);
138
157
  }
139
158
  combined.projects = [...projSet].sort();
159
+ const per = [...new Set(shardInfo.map(x => x.workers))];
160
+ combined.env.push({ k: 'Workers', v: shards.length === 1 ? String(offset) : per.length === 1 ? `${per[0]} per shard · ${offset} in total` : `${offset} in total` });
140
161
  combined.env.push({ k: 'Shards', v: shards.map(s => s.label).join(', ') });
141
162
  if (combined.runStatus === undefined || combined.runStatus === 'passed') {
142
163
  const anyFail = shards.some(s => s.data.runStatus && s.data.runStatus !== 'passed');
package/dist/reporter.js CHANGED
@@ -87,7 +87,9 @@ class ReportingLabsReporter {
87
87
  const scalar = (name, current) => { const v = process.env['REPORTING_LABS_' + name]; return v && v.trim() ? v.trim() : current; };
88
88
  this.options = { ...options, metadata,
89
89
  title: scalar('TITLE', options.title), theme: scalar('THEME', options.theme), palette: scalar('PALETTE', options.palette),
90
- accent: scalar('ACCENT', options.accent), logo: scalar('LOGO', options.logo) };
90
+ accent: scalar('ACCENT', options.accent), logo: scalar('LOGO', options.logo),
91
+ // one folder per shard when several run at once in the same checkout (Jenkins parallel, `&` in a shell)
92
+ outputFolder: scalar('OUTPUT_FOLDER', options.outputFolder) };
91
93
  this.masker = (0, mask_1.makeMasker)(options.maskKeys ?? [], { knownValues: options.maskValues ?? [], fromEnv: options.maskFromEnv !== false });
92
94
  }
93
95
  printsToStdio() { return false; }
@@ -344,7 +344,8 @@ li.collapsed>ul{display:none}
344
344
  .wk .row{display:grid;grid-template-columns:36px 1fr 120px;gap:10px;align-items:center;font-size:12px}
345
345
  .wk .k{font:12px var(--mono);color:var(--ink-3)} .wk .bar{height:12px;display:flex;border-radius:3px;overflow:hidden;background:var(--skip-bg)} .wk .bar i{display:block;height:100%}
346
346
  .wk .n{font:11px var(--mono);color:var(--ink-3);text-align:right}
347
- .wk .row{grid-template-columns:36px 1fr auto} .wk .n{white-space:nowrap}
347
+ .wk .row{grid-template-columns:36px 1fr 172px} .wk .n{white-space:nowrap}
348
+ .wk.wk-sh .row{grid-template-columns:48px 1fr 172px}
348
349
  .proj-sfx{font-weight:400;color:var(--ink-3);font-size:.9em}
349
350
  /* the Breakdown card keeps its own height: a two-priority suite should not leave a tall empty card */
350
351
  .bd-card{align-self:start}
@@ -1560,13 +1561,23 @@ function trend(){
1560
1561
  h('div',{class:'trend-cap'}, h('span',{style:'color:var(--pass)'},'— pass rate'), h('span',{style:'color:var(--fail)'},'- - fail rate'), h('span',{style:'color:var(--accent)'},'▮ duration'), h('span',{style:'margin-left:auto'}, 'this run: '+rate(HIST[HIST.length-1])+'% · '+ms(HIST[HIST.length-1].duration)+(isSmallRun(HIST[HIST.length-1])?' · small run, not plotted':''))));
1561
1562
  return wrap;
1562
1563
  }
1564
+ function laneName(i){ return (data.workerLabels&&data.workerLabels[i])||'w'+i; }
1563
1565
  function workers(){
1564
- const lanes=[]; for(let i=0;i<data.workers;i++) lanes.push({i,tests:0,fail:0,ms:0});
1565
- for(const t of data.tests) for(const r of t.results){ const l=lanes[r.workerIndex]; if(!l) continue; l.tests++; l.ms+=r.duration; if(isFail(r.status)) l.fail++; }
1566
+ const lanes=[]; for(let i=0;i<data.workers;i++) lanes.push({i,tests:0,fail:0,ms:0,failMs:0});
1567
+ for(const t of data.tests) for(const r of t.results){ const l=lanes[r.workerIndex]; if(!l) continue; l.tests++; l.ms+=r.duration; if(isFail(r.status)){ l.fail++; l.failMs+=r.duration; } }
1566
1568
  const max=Math.max(...lanes.map(l=>l.ms),1), busy=lanes.reduce((a,l)=>a+l.ms,0);
1567
- const util=data.duration? Math.round(busy/(data.duration*data.workers)*100):0;
1568
- return h('div',{}, h('div',{class:'wk-sum'}, data.workers+' parallel worker'+(data.workers===1?'':'s')+' · '+util+'% busy · wall clock '+ms(data.duration)+' vs '+ms(busy)+' of test time'),
1569
- h('div',{class:'wk'}, lanes.map(l=>h('div',{class:'row'}, h('span',{class:'k'},'w'+l.i), h('span',{class:'bar'}, h('i',{style:'width:'+((l.ms-0)/max*100)+'%;background:'+(l.fail?'var(--fail)':'var(--pass)'),title:ms(l.ms)})), h('span',{class:'n'}, l.tests+' runs'+(l.fail?' · '+l.fail+' ✕':'')+' · '+ms(l.ms))))));
1569
+ // merged shards: each shard's workers were only available while that shard ran
1570
+ const SH=data.shardInfo&&data.shardInfo.length>1?data.shardInfo:null;
1571
+ const cap=SH? SH.reduce((a,x)=>a+x.duration*x.workers,0) : data.duration*data.workers;
1572
+ const util=cap? Math.min(100,Math.round(busy/cap*100)):0;
1573
+ const perShard=SH? [...new Set(SH.map(x=>x.workers))] : null;
1574
+ const head=!SH? data.workers+' parallel worker'+(data.workers===1?'':'s')
1575
+ : perShard.length===1? SH.length+' shards × '+perShard[0]+' worker'+(perShard[0]===1?'':'s')+' = '+data.workers+' workers'
1576
+ : SH.length+' shards · '+data.workers+' workers in total ('+Math.min(...perShard)+'–'+Math.max(...perShard)+' per shard)';
1577
+ return h('div',{}, h('div',{class:'wk-sum'}, head+' · '+util+'% busy · wall clock '+ms(data.duration)+' vs '+ms(busy)+' of test time'),
1578
+ h('div',{class:'wk'+(SH?' wk-sh':'')}, lanes.map(l=>h('div',{class:'row'}, h('span',{class:'k'},laneName(l.i)),
1579
+ h('span',{class:'bar',title:ms(l.ms)+(l.fail?' · '+ms(l.failMs)+' in failed tests':'')}, h('i',{style:'width:'+((l.ms-l.failMs)/max*100)+'%;background:var(--pass)'}), l.failMs?h('i',{style:'width:'+(l.failMs/max*100)+'%;background:var(--fail)'}):null),
1580
+ h('span',{class:'n'}, l.tests+' runs'+(l.fail?' · '+l.fail+' failed':'')+' · '+ms(l.ms))))));
1570
1581
  }
1571
1582
  function byFile(){
1572
1583
  const m=new Map(); for(const t of data.tests){ const e=m.get(t.file)||{n:0,f:0,fl:0,ms:0}; e.n++; e.ms+=t.duration; if(isFail(t.outcome)) e.f++; if(t.outcome==='flaky') e.fl++; m.set(t.file,e); }
@@ -1576,12 +1587,12 @@ function byFile(){
1576
1587
  h('span',{class:'n'}, e.f?h('b',{},e.f+' ✕ '):null, e.n))));
1577
1588
  }
1578
1589
  function timeline(){
1579
- const W=900, laneH=18, pad=44, gap=6;
1590
+ const W=900, laneH=18, pad=data.workerLabels?62:44, gap=6;
1580
1591
  const t0=data.startTime, t1=Math.max(...data.tests.flatMap(t=>t.results.map(r=>r.startTime+r.duration)), t0+1);
1581
1592
  const span=t1-t0, H=data.workers*(laneH+gap)+24;
1582
1593
  const x = t => pad+ (t-t0)/span*(W-pad-8);
1583
1594
  let s='';
1584
- for(let i=0;i<data.workers;i++){ const y=i*(laneH+gap)+2; s+='<rect class="lane" x="'+pad+'" y="'+y+'" width="'+(W-pad-8)+'" height="'+laneH+'" rx="2"/><text x="0" y="'+(y+13)+'">w'+i+'</text>'; }
1595
+ for(let i=0;i<data.workers;i++){ const y=i*(laneH+gap)+2; s+='<rect class="lane" x="'+pad+'" y="'+y+'" width="'+(W-pad-8)+'" height="'+laneH+'" rx="2"/><text x="0" y="'+(y+13)+'">'+escape(laneName(i))+'</text>'; }
1585
1596
  for(const t of data.tests) for(const r of t.results){
1586
1597
  const y=r.workerIndex*(laneH+gap)+2, x0=x(r.startTime), w=Math.max(2,x(r.startTime+r.duration)-x0);
1587
1598
  const c = isFail(r.status)?'var(--fail)': r.status==='skipped'?'var(--skip)': (t.outcome==='flaky'?'var(--flaky)':'var(--pass)');
package/dist/template.js CHANGED
@@ -415,7 +415,8 @@ li.collapsed>ul{display:none}
415
415
  .wk .row{display:grid;grid-template-columns:36px 1fr 120px;gap:10px;align-items:center;font-size:12px}
416
416
  .wk .k{font:12px var(--mono);color:var(--ink-3)} .wk .bar{height:12px;display:flex;border-radius:3px;overflow:hidden;background:var(--skip-bg)} .wk .bar i{display:block;height:100%}
417
417
  .wk .n{font:11px var(--mono);color:var(--ink-3);text-align:right}
418
- .wk .row{grid-template-columns:36px 1fr auto} .wk .n{white-space:nowrap}
418
+ .wk .row{grid-template-columns:36px 1fr 172px} .wk .n{white-space:nowrap}
419
+ .wk.wk-sh .row{grid-template-columns:48px 1fr 172px}
419
420
  .proj-sfx{font-weight:400;color:var(--ink-3);font-size:.9em}
420
421
  /* the Breakdown card keeps its own height: a two-priority suite should not leave a tall empty card */
421
422
  .bd-card{align-self:start}
@@ -1626,13 +1627,23 @@ function trend(){
1626
1627
  h('div',{class:'trend-cap'}, h('span',{style:'color:var(--pass)'},'— pass rate'), h('span',{style:'color:var(--fail)'},'- - fail rate'), h('span',{style:'color:var(--accent)'},'▮ duration'), h('span',{style:'margin-left:auto'}, 'this run: '+rate(HIST[HIST.length-1])+'% · '+ms(HIST[HIST.length-1].duration)+(isSmallRun(HIST[HIST.length-1])?' · small run, not plotted':''))));
1627
1628
  return wrap;
1628
1629
  }
1630
+ function laneName(i){ return (data.workerLabels&&data.workerLabels[i])||'w'+i; }
1629
1631
  function workers(){
1630
- const lanes=[]; for(let i=0;i<data.workers;i++) lanes.push({i,tests:0,fail:0,ms:0});
1631
- for(const t of data.tests) for(const r of t.results){ const l=lanes[r.workerIndex]; if(!l) continue; l.tests++; l.ms+=r.duration; if(isFail(r.status)) l.fail++; }
1632
+ const lanes=[]; for(let i=0;i<data.workers;i++) lanes.push({i,tests:0,fail:0,ms:0,failMs:0});
1633
+ for(const t of data.tests) for(const r of t.results){ const l=lanes[r.workerIndex]; if(!l) continue; l.tests++; l.ms+=r.duration; if(isFail(r.status)){ l.fail++; l.failMs+=r.duration; } }
1632
1634
  const max=Math.max(...lanes.map(l=>l.ms),1), busy=lanes.reduce((a,l)=>a+l.ms,0);
1633
- const util=data.duration? Math.round(busy/(data.duration*data.workers)*100):0;
1634
- return h('div',{}, h('div',{class:'wk-sum'}, data.workers+' parallel worker'+(data.workers===1?'':'s')+' · '+util+'% busy · wall clock '+ms(data.duration)+' vs '+ms(busy)+' of test time'),
1635
- h('div',{class:'wk'}, lanes.map(l=>h('div',{class:'row'}, h('span',{class:'k'},'w'+l.i), h('span',{class:'bar'}, h('i',{style:'width:'+((l.ms-0)/max*100)+'%;background:'+(l.fail?'var(--fail)':'var(--pass)'),title:ms(l.ms)})), h('span',{class:'n'}, l.tests+' runs'+(l.fail?' · '+l.fail+' ✕':'')+' · '+ms(l.ms))))));
1635
+ // merged shards: each shard's workers were only available while that shard ran
1636
+ const SH=data.shardInfo&&data.shardInfo.length>1?data.shardInfo:null;
1637
+ const cap=SH? SH.reduce((a,x)=>a+x.duration*x.workers,0) : data.duration*data.workers;
1638
+ const util=cap? Math.min(100,Math.round(busy/cap*100)):0;
1639
+ const perShard=SH? [...new Set(SH.map(x=>x.workers))] : null;
1640
+ const head=!SH? data.workers+' parallel worker'+(data.workers===1?'':'s')
1641
+ : perShard.length===1? SH.length+' shards × '+perShard[0]+' worker'+(perShard[0]===1?'':'s')+' = '+data.workers+' workers'
1642
+ : SH.length+' shards · '+data.workers+' workers in total ('+Math.min(...perShard)+'–'+Math.max(...perShard)+' per shard)';
1643
+ return h('div',{}, h('div',{class:'wk-sum'}, head+' · '+util+'% busy · wall clock '+ms(data.duration)+' vs '+ms(busy)+' of test time'),
1644
+ h('div',{class:'wk'+(SH?' wk-sh':'')}, lanes.map(l=>h('div',{class:'row'}, h('span',{class:'k'},laneName(l.i)),
1645
+ h('span',{class:'bar',title:ms(l.ms)+(l.fail?' · '+ms(l.failMs)+' in failed tests':'')}, h('i',{style:'width:'+((l.ms-l.failMs)/max*100)+'%;background:var(--pass)'}), l.failMs?h('i',{style:'width:'+(l.failMs/max*100)+'%;background:var(--fail)'}):null),
1646
+ h('span',{class:'n'}, l.tests+' runs'+(l.fail?' · '+l.fail+' failed':'')+' · '+ms(l.ms))))));
1636
1647
  }
1637
1648
  function byFile(){
1638
1649
  const m=new Map(); for(const t of data.tests){ const e=m.get(t.file)||{n:0,f:0,fl:0,ms:0}; e.n++; e.ms+=t.duration; if(isFail(t.outcome)) e.f++; if(t.outcome==='flaky') e.fl++; m.set(t.file,e); }
@@ -1642,12 +1653,12 @@ function byFile(){
1642
1653
  h('span',{class:'n'}, e.f?h('b',{},e.f+' ✕ '):null, e.n))));
1643
1654
  }
1644
1655
  function timeline(){
1645
- const W=900, laneH=18, pad=44, gap=6;
1656
+ const W=900, laneH=18, pad=data.workerLabels?62:44, gap=6;
1646
1657
  const t0=data.startTime, t1=Math.max(...data.tests.flatMap(t=>t.results.map(r=>r.startTime+r.duration)), t0+1);
1647
1658
  const span=t1-t0, H=data.workers*(laneH+gap)+24;
1648
1659
  const x = t => pad+ (t-t0)/span*(W-pad-8);
1649
1660
  let s='';
1650
- for(let i=0;i<data.workers;i++){ const y=i*(laneH+gap)+2; s+='<rect class="lane" x="'+pad+'" y="'+y+'" width="'+(W-pad-8)+'" height="'+laneH+'" rx="2"/><text x="0" y="'+(y+13)+'">w'+i+'</text>'; }
1661
+ for(let i=0;i<data.workers;i++){ const y=i*(laneH+gap)+2; s+='<rect class="lane" x="'+pad+'" y="'+y+'" width="'+(W-pad-8)+'" height="'+laneH+'" rx="2"/><text x="0" y="'+(y+13)+'">'+escape(laneName(i))+'</text>'; }
1651
1662
  for(const t of data.tests) for(const r of t.results){
1652
1663
  const y=r.workerIndex*(laneH+gap)+2, x0=x(r.startTime), w=Math.max(2,x(r.startTime+r.duration)-x0);
1653
1664
  const c = isFail(r.status)?'var(--fail)': r.status==='skipped'?'var(--skip)': (t.outcome==='flaky'?'var(--flaky)':'var(--pass)');
package/dist/types.d.ts CHANGED
@@ -316,6 +316,14 @@ export interface ReportData {
316
316
  current: number;
317
317
  total: number;
318
318
  };
319
+ /** Set by `reporting-labs merge`: one lane name per worker (S1·w0, S1·w1, S2·w0 ...) and each shard's size and timing. */
320
+ workerLabels?: string[];
321
+ shardInfo?: Array<{
322
+ shard: number;
323
+ workers: number;
324
+ startTime: number;
325
+ duration: number;
326
+ }>;
319
327
  options: {
320
328
  logo?: string;
321
329
  accent?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reporting-labs",
3
- "version": "0.6.13",
3
+ "version": "0.6.14",
4
4
  "description": "reportingLabs – beautiful, customizable single-file HTML test reports. One line of config. Playwright adapter included, more runners on the way.",
5
5
  "keywords": [
6
6
  "test-report",