reporting-labs 0.6.13 → 0.6.15
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 +102 -47
- package/bin/build-template.js +1 -0
- package/bin/config-template.txt +1 -0
- package/bin/merge.js +26 -5
- package/dist/reporter.js +4 -1
- package/dist/template.html +28 -10
- package/dist/template.js +28 -10
- package/dist/types.d.ts +11 -0
- package/dist/wdio/finalize.d.ts +1 -0
- package/dist/wdio/finalize.js +1 -0
- package/package.json +1 -1
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 (
|
|
124
|
+
### Or write it as a comment (your choice)
|
|
125
125
|
|
|
126
|
-
|
|
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
|
|
146
|
+
// ... your test as usual
|
|
136
147
|
});
|
|
137
148
|
```
|
|
138
149
|
|
|
139
|
-
-
|
|
140
|
-
-
|
|
141
|
-
-
|
|
142
|
-
-
|
|
143
|
-
-
|
|
144
|
-
- **
|
|
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
|
-
|
|
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
|
-
|
|
340
|
+
✅ built in · 🟡 possible with extra setup · ❌ not in the official docs
|
|
294
341
|
|
|
295
|
-
|
|
|
342
|
+
| | Playwright HTML | Allure | **reportingLabs** |
|
|
296
343
|
|---|:---:|:---:|:---:|
|
|
297
|
-
|
|
|
298
|
-
|
|
|
299
|
-
|
|
|
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, pytest-bdd, Robot, JUnit 5, TestNG, Cucumber</sub> |
|
|
349
|
+
| **Each test** | | | |
|
|
300
350
|
| Steps, screenshots, videos, traces | ✅ | ✅ | ✅ |
|
|
301
|
-
|
|
|
302
|
-
|
|
|
303
|
-
|
|
|
304
|
-
|
|
|
305
|
-
| Failures
|
|
306
|
-
|
|
|
307
|
-
|
|
|
308
|
-
|
|
|
309
|
-
|
|
|
310
|
-
|
|
|
311
|
-
|
|
|
312
|
-
|
|
|
313
|
-
|
|
|
314
|
-
|
|
|
315
|
-
|
|
|
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
|
-
|
|
|
322
|
-
|
|
|
323
|
-
|
|
|
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
|
|
|
@@ -350,6 +400,7 @@ Every option is optional. `npx reporting-labs init` writes them all, with commen
|
|
|
350
400
|
| `theme` | `'auto'` | `'light'`, `'dark'` or follow the OS |
|
|
351
401
|
| `customCss` | `''` | CSS appended to the report |
|
|
352
402
|
| `editorLinks` | on locally, off in CI | "Open in VS Code" links |
|
|
403
|
+
| `expandFailedSteps` | `true` | Open the steps that lead to a failure. `false`: every step with sub-steps starts collapsed (also on failures); **Expand all / Collapse all** above the steps either way |
|
|
353
404
|
| `bdd` | auto | Style Given/When/Then steps as Gherkin |
|
|
354
405
|
| `outputFolder` | `'reporting-labs'` | Where the report goes |
|
|
355
406
|
| `outputFile` | `'index.html'` | Report file name |
|
|
@@ -362,9 +413,10 @@ Every option is optional. `npx reporting-labs init` writes them all, with commen
|
|
|
362
413
|
| `embedFonts` | `true` | Bundle the fonts (~140 KB) so it looks the same offline |
|
|
363
414
|
| `announce` | `true` | Print the report path after the run |
|
|
364
415
|
| `open` | `'on-failure'` | Open the report in the browser after the run: `'on-failure'`, `'always'` or `'never'`. Never opens in CI |
|
|
365
|
-
| `
|
|
416
|
+
| `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 |
|
|
417
|
+
| `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
418
|
|
|
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.
|
|
419
|
+
**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
420
|
|
|
369
421
|
If your reporter list differs between CI and local, add the same line to both:
|
|
370
422
|
|
|
@@ -424,10 +476,11 @@ Three shards, run one after another (on a single machine you cannot really run t
|
|
|
424
476
|
rm -rf all-shards merged
|
|
425
477
|
|
|
426
478
|
# Run each shard and move its folder aside so the next shard does not overwrite it
|
|
479
|
+
# (use ; not &&: a shard with a failing test exits 1, and && would skip its mv)
|
|
427
480
|
mkdir -p all-shards
|
|
428
|
-
npx playwright test --shard=1/3
|
|
429
|
-
npx playwright test --shard=2/3
|
|
430
|
-
npx playwright test --shard=3/3
|
|
481
|
+
npx playwright test --shard=1/3; mv reporting-labs all-shards/s1
|
|
482
|
+
npx playwright test --shard=2/3; mv reporting-labs all-shards/s2
|
|
483
|
+
npx playwright test --shard=3/3; mv reporting-labs all-shards/s3
|
|
431
484
|
|
|
432
485
|
# One command combines them
|
|
433
486
|
npx reporting-labs merge all-shards -o merged
|
|
@@ -452,18 +505,20 @@ That line proves the reporter ran and the folder exists to move. If you do not s
|
|
|
452
505
|
mv my-report all-shards/s1
|
|
453
506
|
```
|
|
454
507
|
|
|
455
|
-
**
|
|
508
|
+
**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
509
|
|
|
457
510
|
```bash
|
|
458
511
|
rm -rf all-shards merged && mkdir -p all-shards
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
512
|
+
REPORTING_LABS_OUTPUT_FOLDER=all-shards/s1 npx playwright test --shard=1/3 --output=test-results/s1 &
|
|
513
|
+
REPORTING_LABS_OUTPUT_FOLDER=all-shards/s2 npx playwright test --shard=2/3 --output=test-results/s2 &
|
|
514
|
+
REPORTING_LABS_OUTPUT_FOLDER=all-shards/s3 npx playwright test --shard=3/3 --output=test-results/s3 &
|
|
462
515
|
wait
|
|
463
516
|
npx reporting-labs merge all-shards -o merged
|
|
464
517
|
open merged/index.html
|
|
465
518
|
```
|
|
466
519
|
|
|
520
|
+
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.
|
|
521
|
+
|
|
467
522
|
#### GitHub Actions
|
|
468
523
|
|
|
469
524
|
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/build-template.js
CHANGED
package/bin/config-template.txt
CHANGED
|
@@ -61,6 +61,7 @@ const config: ReportingLabsOptions = {
|
|
|
61
61
|
// },
|
|
62
62
|
// maskKeys: ['otp', 'pan'], // extra keys to mask as **** (passwords, tokens, cookies already are)
|
|
63
63
|
// editorLinks: true, // "Open in VS Code" on every test; default: on locally, off in CI
|
|
64
|
+
// expandFailedSteps: true, // open the steps leading to a failure; false = all steps start collapsed
|
|
64
65
|
// bdd: false, // style Given/When/Then steps as Gherkin; default: auto-detect
|
|
65
66
|
|
|
66
67
|
// ── Run history and trend ────────────────────────────────────────────────────
|
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:
|
|
107
|
-
duration:
|
|
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:
|
|
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
|
-
|
|
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; }
|
|
@@ -232,6 +234,7 @@ class ReportingLabsReporter {
|
|
|
232
234
|
links: this.linkUrls(),
|
|
233
235
|
customCss: this.options.customCss ?? '',
|
|
234
236
|
editorLinks: this.options.editorLinks ?? !process.env.CI,
|
|
237
|
+
expandFailedSteps: this.options.expandFailedSteps ?? true,
|
|
235
238
|
},
|
|
236
239
|
};
|
|
237
240
|
const file = path.join(this.outDir, this.options.outputFile ?? 'index.html');
|
package/dist/template.html
CHANGED
|
@@ -229,6 +229,9 @@ a{color:var(--accent)}
|
|
|
229
229
|
.step.skip .t,.step.skip .kw,.step.skip .d{color:var(--ink-3);font-style:italic}
|
|
230
230
|
.step .e{font:12px var(--mono);color:var(--fail);padding:2px 0 6px 28px;white-space:pre-wrap}
|
|
231
231
|
li.collapsed>ul{display:none}
|
|
232
|
+
.st-h{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap} .detail .st-h .hint{margin-left:0} .st-h .st-tools{margin-left:auto;display:inline-flex;gap:12px;text-transform:none;letter-spacing:0}
|
|
233
|
+
.st-tools button{background:none;border:0;padding:0;font:500 12px var(--sans);color:var(--accent);cursor:pointer} .st-tools button:hover{text-decoration:underline}
|
|
234
|
+
@media print{.st-tools{display:none}}
|
|
232
235
|
.att{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px}
|
|
233
236
|
.att figure{margin:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--surface-2)}
|
|
234
237
|
.att img{width:100%;display:block;aspect-ratio:16/10;object-fit:cover;cursor:zoom-in}
|
|
@@ -344,7 +347,8 @@ li.collapsed>ul{display:none}
|
|
|
344
347
|
.wk .row{display:grid;grid-template-columns:36px 1fr 120px;gap:10px;align-items:center;font-size:12px}
|
|
345
348
|
.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
349
|
.wk .n{font:11px var(--mono);color:var(--ink-3);text-align:right}
|
|
347
|
-
.wk .row{grid-template-columns:36px 1fr
|
|
350
|
+
.wk .row{grid-template-columns:36px 1fr 172px} .wk .n{white-space:nowrap}
|
|
351
|
+
.wk.wk-sh .row{grid-template-columns:48px 1fr 172px}
|
|
348
352
|
.proj-sfx{font-weight:400;color:var(--ink-3);font-size:.9em}
|
|
349
353
|
/* the Breakdown card keeps its own height: a two-priority suite should not leave a tall empty card */
|
|
350
354
|
.bd-card{align-self:start}
|
|
@@ -1560,13 +1564,23 @@ function trend(){
|
|
|
1560
1564
|
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
1565
|
return wrap;
|
|
1562
1566
|
}
|
|
1567
|
+
function laneName(i){ return (data.workerLabels&&data.workerLabels[i])||'w'+i; }
|
|
1563
1568
|
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++; }
|
|
1569
|
+
const lanes=[]; for(let i=0;i<data.workers;i++) lanes.push({i,tests:0,fail:0,ms:0,failMs:0});
|
|
1570
|
+
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
1571
|
const max=Math.max(...lanes.map(l=>l.ms),1), busy=lanes.reduce((a,l)=>a+l.ms,0);
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1572
|
+
// merged shards: each shard's workers were only available while that shard ran
|
|
1573
|
+
const SH=data.shardInfo&&data.shardInfo.length>1?data.shardInfo:null;
|
|
1574
|
+
const cap=SH? SH.reduce((a,x)=>a+x.duration*x.workers,0) : data.duration*data.workers;
|
|
1575
|
+
const util=cap? Math.min(100,Math.round(busy/cap*100)):0;
|
|
1576
|
+
const perShard=SH? [...new Set(SH.map(x=>x.workers))] : null;
|
|
1577
|
+
const head=!SH? data.workers+' parallel worker'+(data.workers===1?'':'s')
|
|
1578
|
+
: perShard.length===1? SH.length+' shards × '+perShard[0]+' worker'+(perShard[0]===1?'':'s')+' = '+data.workers+' workers'
|
|
1579
|
+
: SH.length+' shards · '+data.workers+' workers in total ('+Math.min(...perShard)+'–'+Math.max(...perShard)+' per shard)';
|
|
1580
|
+
return h('div',{}, h('div',{class:'wk-sum'}, head+' · '+util+'% busy · wall clock '+ms(data.duration)+' vs '+ms(busy)+' of test time'),
|
|
1581
|
+
h('div',{class:'wk'+(SH?' wk-sh':'')}, lanes.map(l=>h('div',{class:'row'}, h('span',{class:'k'},laneName(l.i)),
|
|
1582
|
+
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),
|
|
1583
|
+
h('span',{class:'n'}, l.tests+' runs'+(l.fail?' · '+l.fail+' failed':'')+' · '+ms(l.ms))))));
|
|
1570
1584
|
}
|
|
1571
1585
|
function byFile(){
|
|
1572
1586
|
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 +1590,12 @@ function byFile(){
|
|
|
1576
1590
|
h('span',{class:'n'}, e.f?h('b',{},e.f+' ✕ '):null, e.n))));
|
|
1577
1591
|
}
|
|
1578
1592
|
function timeline(){
|
|
1579
|
-
const W=900, laneH=18, pad=44, gap=6;
|
|
1593
|
+
const W=900, laneH=18, pad=data.workerLabels?62:44, gap=6;
|
|
1580
1594
|
const t0=data.startTime, t1=Math.max(...data.tests.flatMap(t=>t.results.map(r=>r.startTime+r.duration)), t0+1);
|
|
1581
1595
|
const span=t1-t0, H=data.workers*(laneH+gap)+24;
|
|
1582
1596
|
const x = t => pad+ (t-t0)/span*(W-pad-8);
|
|
1583
1597
|
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)+'">
|
|
1598
|
+
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
1599
|
for(const t of data.tests) for(const r of t.results){
|
|
1586
1600
|
const y=r.workerIndex*(laneH+gap)+2, x0=x(r.startTime), w=Math.max(2,x(r.startTime+r.duration)-x0);
|
|
1587
1601
|
const c = isFail(r.status)?'var(--fail)': r.status==='skipped'?'var(--skip)': (t.outcome==='flaky'?'var(--flaky)':'var(--pass)');
|
|
@@ -1713,7 +1727,9 @@ function renderDetail(t, d, retryIdx){
|
|
|
1713
1727
|
const body=h('div',{});
|
|
1714
1728
|
if(t.note&&retry===t.results.length-1) body.append(h('div',{class:'note '+(t.outcome==='passed'?'ok':'warn')}, t.note));
|
|
1715
1729
|
if(r.errors.length){ body.append(h('h4',{},r.errors.length>1?'Errors':'Error'), ...r.errors.map(errorView)); }
|
|
1716
|
-
if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0));
|
|
1730
|
+
if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0)); const tree=stepTree(r.steps, stepTotal), nested=r.steps.some(x=>x.steps.length);
|
|
1731
|
+
body.append(h('h4',{class:'st-h'},data.bdd?'Scenario steps':'Steps', h('span',{class:'hint'},'bar = share of '+ms(stepTotal)),
|
|
1732
|
+
nested? h('span',{class:'st-tools'}, h('button',{type:'button',onclick:()=>setSteps(tree,false)},'Expand all'), h('button',{type:'button',onclick:()=>setSteps(tree,true)},'Collapse all')) : null), tree); }
|
|
1717
1733
|
if(r.logs.length){ const t0=r.startTime; body.append(h('h4',{},'Log'), h('div',{class:'logs'}, r.logs.map(l=>h('div',{class:'ln'+(/\b(error|fail|exception)\b/i.test(l.msg)?' err':/\bwarn/i.test(l.msg)?' warn':'')}, h('span',{class:'ts'},'+'+ms(Math.max(0,l.t-t0))), h('span',{class:'lm'},l.msg))))); }
|
|
1718
1734
|
for(const b of r.data){ body.append(h('h4',{},b.name), dataBlock(b)); }
|
|
1719
1735
|
if(r.api.length){ body.append(h('h4',{},r.api.length+' API call'+(r.api.length>1?'s':'')), ...r.api.map(c=>apiPanel(c,r))); body.append(h('div',{class:'mask-note'},'Secrets and auth headers are masked as ****')); }
|
|
@@ -1746,7 +1762,8 @@ function renderDetail(t, d, retryIdx){
|
|
|
1746
1762
|
function stepTree(steps, total){
|
|
1747
1763
|
return h('ul',{class:'steps'}, steps.map(s=>{
|
|
1748
1764
|
const bad=!!s.error, skip=s.status==='skipped', kids=s.steps.length>0, pct=total?Math.min(100,s.duration/total*100):0;
|
|
1749
|
-
|
|
1765
|
+
// a step with sub-steps starts collapsed; the path to a failure starts open unless expandFailedSteps is false
|
|
1766
|
+
const li=h('li',{class:kids&&(data.options.expandFailedSteps===false||!hasError(s))?'collapsed':''});
|
|
1750
1767
|
const row=h('div',{class:'step'+(bad?' bad':'')+(skip?' skip':'')},
|
|
1751
1768
|
h('span',{class:'tw'}, kids? '▸' : ''), data.bdd?null:h('span',{class:'cat'},s.category), gherkin(s.title), total&&!skip? h('span',{class:'tb',title:Math.round(pct)+'% of the test'}, h('i',{class:pct>=30?'slow':'',style:'width:'+Math.max(pct,s.duration>0?1.5:0)+'%'})) : null, h('span',{class:'d'},skip?'not run':ms(s.duration)));
|
|
1752
1769
|
if(kids){ row.style.cursor='pointer'; row.addEventListener('click',()=>{li.classList.toggle('collapsed'); row.querySelector('.tw').textContent=li.classList.contains('collapsed')?'▸':'▾';}); if(!li.classList.contains('collapsed')) row.querySelector('.tw').textContent='▾'; }
|
|
@@ -1756,6 +1773,7 @@ function stepTree(steps, total){
|
|
|
1756
1773
|
}
|
|
1757
1774
|
function gherkin(title){ const m=data.bdd&&title.match(/^(Given|When|Then|And|But)\b\s*(.*)$/); if(!m) return h('span',{class:'t',title},title); return h('span',{class:'t',title}, h('span',{class:'kw'+(/^(And|But)$/.test(m[1])?' and':'')},m[1]), m[2]); }
|
|
1758
1775
|
function hasError(s){ return !!s.error || s.steps.some(hasError); }
|
|
1776
|
+
function setSteps(tree, collapsed){ for(const li of tree.querySelectorAll('li')){ const tw=li.querySelector(':scope>.step>.tw'); if(!tw||!tw.textContent) continue; li.classList.toggle('collapsed',collapsed); tw.textContent=collapsed?'▸':'▾'; } }
|
|
1759
1777
|
function dataBlock(b){
|
|
1760
1778
|
if(b.kind==='table') return h('div',{}, h('div',{class:'tbl-wrap'}, h('table',{class:'tbl'}, h('thead',{}, h('tr',{}, b.columns.map(c=>h('th',{},c)))), h('tbody',{}, b.rows.map(r=>h('tr',{}, r.map(c=>h('td',{class:c==='****'?'mask':'',title:c},c))))))), h('div',{class:'mask-note'}, b.rows.length+' rows · sensitive columns masked'));
|
|
1761
1779
|
if(b.kind==='kv') return h('dl',{class:'kv2'}, b.kv.map(([k,v])=>[h('dt',{},k),h('dd',{class:v==='****'?'mask':''},v)]));
|
package/dist/template.js
CHANGED
|
@@ -300,6 +300,9 @@ a{color:var(--accent)}
|
|
|
300
300
|
.step.skip .t,.step.skip .kw,.step.skip .d{color:var(--ink-3);font-style:italic}
|
|
301
301
|
.step .e{font:12px var(--mono);color:var(--fail);padding:2px 0 6px 28px;white-space:pre-wrap}
|
|
302
302
|
li.collapsed>ul{display:none}
|
|
303
|
+
.st-h{display:flex;align-items:baseline;gap:8px;flex-wrap:wrap} .detail .st-h .hint{margin-left:0} .st-h .st-tools{margin-left:auto;display:inline-flex;gap:12px;text-transform:none;letter-spacing:0}
|
|
304
|
+
.st-tools button{background:none;border:0;padding:0;font:500 12px var(--sans);color:var(--accent);cursor:pointer} .st-tools button:hover{text-decoration:underline}
|
|
305
|
+
@media print{.st-tools{display:none}}
|
|
303
306
|
.att{display:grid;grid-template-columns:repeat(auto-fill,minmax(180px,1fr));gap:10px}
|
|
304
307
|
.att figure{margin:0;border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;background:var(--surface-2)}
|
|
305
308
|
.att img{width:100%;display:block;aspect-ratio:16/10;object-fit:cover;cursor:zoom-in}
|
|
@@ -415,7 +418,8 @@ li.collapsed>ul{display:none}
|
|
|
415
418
|
.wk .row{display:grid;grid-template-columns:36px 1fr 120px;gap:10px;align-items:center;font-size:12px}
|
|
416
419
|
.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
420
|
.wk .n{font:11px var(--mono);color:var(--ink-3);text-align:right}
|
|
418
|
-
.wk .row{grid-template-columns:36px 1fr
|
|
421
|
+
.wk .row{grid-template-columns:36px 1fr 172px} .wk .n{white-space:nowrap}
|
|
422
|
+
.wk.wk-sh .row{grid-template-columns:48px 1fr 172px}
|
|
419
423
|
.proj-sfx{font-weight:400;color:var(--ink-3);font-size:.9em}
|
|
420
424
|
/* the Breakdown card keeps its own height: a two-priority suite should not leave a tall empty card */
|
|
421
425
|
.bd-card{align-self:start}
|
|
@@ -1626,13 +1630,23 @@ function trend(){
|
|
|
1626
1630
|
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
1631
|
return wrap;
|
|
1628
1632
|
}
|
|
1633
|
+
function laneName(i){ return (data.workerLabels&&data.workerLabels[i])||'w'+i; }
|
|
1629
1634
|
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++; }
|
|
1635
|
+
const lanes=[]; for(let i=0;i<data.workers;i++) lanes.push({i,tests:0,fail:0,ms:0,failMs:0});
|
|
1636
|
+
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
1637
|
const max=Math.max(...lanes.map(l=>l.ms),1), busy=lanes.reduce((a,l)=>a+l.ms,0);
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1638
|
+
// merged shards: each shard's workers were only available while that shard ran
|
|
1639
|
+
const SH=data.shardInfo&&data.shardInfo.length>1?data.shardInfo:null;
|
|
1640
|
+
const cap=SH? SH.reduce((a,x)=>a+x.duration*x.workers,0) : data.duration*data.workers;
|
|
1641
|
+
const util=cap? Math.min(100,Math.round(busy/cap*100)):0;
|
|
1642
|
+
const perShard=SH? [...new Set(SH.map(x=>x.workers))] : null;
|
|
1643
|
+
const head=!SH? data.workers+' parallel worker'+(data.workers===1?'':'s')
|
|
1644
|
+
: perShard.length===1? SH.length+' shards × '+perShard[0]+' worker'+(perShard[0]===1?'':'s')+' = '+data.workers+' workers'
|
|
1645
|
+
: SH.length+' shards · '+data.workers+' workers in total ('+Math.min(...perShard)+'–'+Math.max(...perShard)+' per shard)';
|
|
1646
|
+
return h('div',{}, h('div',{class:'wk-sum'}, head+' · '+util+'% busy · wall clock '+ms(data.duration)+' vs '+ms(busy)+' of test time'),
|
|
1647
|
+
h('div',{class:'wk'+(SH?' wk-sh':'')}, lanes.map(l=>h('div',{class:'row'}, h('span',{class:'k'},laneName(l.i)),
|
|
1648
|
+
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),
|
|
1649
|
+
h('span',{class:'n'}, l.tests+' runs'+(l.fail?' · '+l.fail+' failed':'')+' · '+ms(l.ms))))));
|
|
1636
1650
|
}
|
|
1637
1651
|
function byFile(){
|
|
1638
1652
|
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 +1656,12 @@ function byFile(){
|
|
|
1642
1656
|
h('span',{class:'n'}, e.f?h('b',{},e.f+' ✕ '):null, e.n))));
|
|
1643
1657
|
}
|
|
1644
1658
|
function timeline(){
|
|
1645
|
-
const W=900, laneH=18, pad=44, gap=6;
|
|
1659
|
+
const W=900, laneH=18, pad=data.workerLabels?62:44, gap=6;
|
|
1646
1660
|
const t0=data.startTime, t1=Math.max(...data.tests.flatMap(t=>t.results.map(r=>r.startTime+r.duration)), t0+1);
|
|
1647
1661
|
const span=t1-t0, H=data.workers*(laneH+gap)+24;
|
|
1648
1662
|
const x = t => pad+ (t-t0)/span*(W-pad-8);
|
|
1649
1663
|
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)+'">
|
|
1664
|
+
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
1665
|
for(const t of data.tests) for(const r of t.results){
|
|
1652
1666
|
const y=r.workerIndex*(laneH+gap)+2, x0=x(r.startTime), w=Math.max(2,x(r.startTime+r.duration)-x0);
|
|
1653
1667
|
const c = isFail(r.status)?'var(--fail)': r.status==='skipped'?'var(--skip)': (t.outcome==='flaky'?'var(--flaky)':'var(--pass)');
|
|
@@ -1779,7 +1793,9 @@ function renderDetail(t, d, retryIdx){
|
|
|
1779
1793
|
const body=h('div',{});
|
|
1780
1794
|
if(t.note&&retry===t.results.length-1) body.append(h('div',{class:'note '+(t.outcome==='passed'?'ok':'warn')}, t.note));
|
|
1781
1795
|
if(r.errors.length){ body.append(h('h4',{},r.errors.length>1?'Errors':'Error'), ...r.errors.map(errorView)); }
|
|
1782
|
-
if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0));
|
|
1796
|
+
if(r.steps.length){ const stepTotal=Math.max(1, r.duration||0, r.steps.reduce((a,x)=>a+x.duration,0)); const tree=stepTree(r.steps, stepTotal), nested=r.steps.some(x=>x.steps.length);
|
|
1797
|
+
body.append(h('h4',{class:'st-h'},data.bdd?'Scenario steps':'Steps', h('span',{class:'hint'},'bar = share of '+ms(stepTotal)),
|
|
1798
|
+
nested? h('span',{class:'st-tools'}, h('button',{type:'button',onclick:()=>setSteps(tree,false)},'Expand all'), h('button',{type:'button',onclick:()=>setSteps(tree,true)},'Collapse all')) : null), tree); }
|
|
1783
1799
|
if(r.logs.length){ const t0=r.startTime; body.append(h('h4',{},'Log'), h('div',{class:'logs'}, r.logs.map(l=>h('div',{class:'ln'+(/\b(error|fail|exception)\b/i.test(l.msg)?' err':/\bwarn/i.test(l.msg)?' warn':'')}, h('span',{class:'ts'},'+'+ms(Math.max(0,l.t-t0))), h('span',{class:'lm'},l.msg))))); }
|
|
1784
1800
|
for(const b of r.data){ body.append(h('h4',{},b.name), dataBlock(b)); }
|
|
1785
1801
|
if(r.api.length){ body.append(h('h4',{},r.api.length+' API call'+(r.api.length>1?'s':'')), ...r.api.map(c=>apiPanel(c,r))); body.append(h('div',{class:'mask-note'},'Secrets and auth headers are masked as ****')); }
|
|
@@ -1812,7 +1828,8 @@ function renderDetail(t, d, retryIdx){
|
|
|
1812
1828
|
function stepTree(steps, total){
|
|
1813
1829
|
return h('ul',{class:'steps'}, steps.map(s=>{
|
|
1814
1830
|
const bad=!!s.error, skip=s.status==='skipped', kids=s.steps.length>0, pct=total?Math.min(100,s.duration/total*100):0;
|
|
1815
|
-
|
|
1831
|
+
// a step with sub-steps starts collapsed; the path to a failure starts open unless expandFailedSteps is false
|
|
1832
|
+
const li=h('li',{class:kids&&(data.options.expandFailedSteps===false||!hasError(s))?'collapsed':''});
|
|
1816
1833
|
const row=h('div',{class:'step'+(bad?' bad':'')+(skip?' skip':'')},
|
|
1817
1834
|
h('span',{class:'tw'}, kids? '▸' : ''), data.bdd?null:h('span',{class:'cat'},s.category), gherkin(s.title), total&&!skip? h('span',{class:'tb',title:Math.round(pct)+'% of the test'}, h('i',{class:pct>=30?'slow':'',style:'width:'+Math.max(pct,s.duration>0?1.5:0)+'%'})) : null, h('span',{class:'d'},skip?'not run':ms(s.duration)));
|
|
1818
1835
|
if(kids){ row.style.cursor='pointer'; row.addEventListener('click',()=>{li.classList.toggle('collapsed'); row.querySelector('.tw').textContent=li.classList.contains('collapsed')?'▸':'▾';}); if(!li.classList.contains('collapsed')) row.querySelector('.tw').textContent='▾'; }
|
|
@@ -1822,6 +1839,7 @@ function stepTree(steps, total){
|
|
|
1822
1839
|
}
|
|
1823
1840
|
function gherkin(title){ const m=data.bdd&&title.match(/^(Given|When|Then|And|But)\b\s*(.*)$/); if(!m) return h('span',{class:'t',title},title); return h('span',{class:'t',title}, h('span',{class:'kw'+(/^(And|But)$/.test(m[1])?' and':'')},m[1]), m[2]); }
|
|
1824
1841
|
function hasError(s){ return !!s.error || s.steps.some(hasError); }
|
|
1842
|
+
function setSteps(tree, collapsed){ for(const li of tree.querySelectorAll('li')){ const tw=li.querySelector(':scope>.step>.tw'); if(!tw||!tw.textContent) continue; li.classList.toggle('collapsed',collapsed); tw.textContent=collapsed?'▸':'▾'; } }
|
|
1825
1843
|
function dataBlock(b){
|
|
1826
1844
|
if(b.kind==='table') return h('div',{}, h('div',{class:'tbl-wrap'}, h('table',{class:'tbl'}, h('thead',{}, h('tr',{}, b.columns.map(c=>h('th',{},c)))), h('tbody',{}, b.rows.map(r=>h('tr',{}, r.map(c=>h('td',{class:c==='****'?'mask':'',title:c},c))))))), h('div',{class:'mask-note'}, b.rows.length+' rows · sensitive columns masked'));
|
|
1827
1845
|
if(b.kind==='kv') return h('dl',{class:'kv2'}, b.kv.map(([k,v])=>[h('dt',{},k),h('dd',{class:v==='****'?'mask':''},v)]));
|
package/dist/types.d.ts
CHANGED
|
@@ -116,6 +116,8 @@ export interface ReportingLabsOptions {
|
|
|
116
116
|
env?: Record<string, string>;
|
|
117
117
|
/** Show an "Open in VS Code" link on every test (vscode://file/...). Default: true locally, false when the CI env var is set. */
|
|
118
118
|
editorLinks?: boolean;
|
|
119
|
+
/** Open the steps that lead to a failure when a failed test is opened (default true). false: every step with sub-steps starts collapsed, also on failures. */
|
|
120
|
+
expandFailedSteps?: boolean;
|
|
119
121
|
/** Style Given/When/Then steps as Gherkin and label describe blocks as Features/Scenarios. Default: auto-detect */
|
|
120
122
|
bdd?: boolean;
|
|
121
123
|
}
|
|
@@ -316,6 +318,14 @@ export interface ReportData {
|
|
|
316
318
|
current: number;
|
|
317
319
|
total: number;
|
|
318
320
|
};
|
|
321
|
+
/** Set by `reporting-labs merge`: one lane name per worker (S1·w0, S1·w1, S2·w0 ...) and each shard's size and timing. */
|
|
322
|
+
workerLabels?: string[];
|
|
323
|
+
shardInfo?: Array<{
|
|
324
|
+
shard: number;
|
|
325
|
+
workers: number;
|
|
326
|
+
startTime: number;
|
|
327
|
+
duration: number;
|
|
328
|
+
}>;
|
|
319
329
|
options: {
|
|
320
330
|
logo?: string;
|
|
321
331
|
accent?: string;
|
|
@@ -333,5 +343,6 @@ export interface ReportData {
|
|
|
333
343
|
links: Record<string, string>;
|
|
334
344
|
customCss: string;
|
|
335
345
|
editorLinks: boolean;
|
|
346
|
+
expandFailedSteps?: boolean;
|
|
336
347
|
};
|
|
337
348
|
}
|
package/dist/wdio/finalize.d.ts
CHANGED
|
@@ -35,5 +35,6 @@ export interface ReportingLabsCompleteOptions {
|
|
|
35
35
|
maskFromEnv?: boolean;
|
|
36
36
|
embedFonts?: boolean;
|
|
37
37
|
editorLinks?: boolean;
|
|
38
|
+
expandFailedSteps?: boolean;
|
|
38
39
|
}
|
|
39
40
|
export declare function reportingLabsComplete(options?: ReportingLabsCompleteOptions): Promise<string | undefined>;
|
package/dist/wdio/finalize.js
CHANGED
|
@@ -156,6 +156,7 @@ async function reportingLabsComplete(options = {}) {
|
|
|
156
156
|
links: Object.fromEntries(Object.entries(options.links ?? {}).map(([k, v]) => [k.toLowerCase(), typeof v === 'string' ? v : v.url])),
|
|
157
157
|
customCss: options.customCss ?? '',
|
|
158
158
|
editorLinks: options.editorLinks ?? !process.env.CI,
|
|
159
|
+
expandFailedSteps: options.expandFailedSteps ?? true,
|
|
159
160
|
},
|
|
160
161
|
};
|
|
161
162
|
fs.mkdirSync(outputFolder, { recursive: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reporting-labs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.15",
|
|
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",
|