reporting-labs 0.6.12 → 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 +122 -38
- package/bin/cli.js +13 -0
- package/bin/config-template.txt +2 -0
- package/bin/merge.js +26 -5
- package/bin/snippets.code-snippets +78 -0
- package/dist/comments.d.ts +26 -0
- package/dist/comments.js +125 -0
- package/dist/reporter.d.ts +2 -0
- package/dist/reporter.js +39 -7
- package/dist/template.html +19 -8
- package/dist/template.js +19 -8
- package/dist/types.d.ts +11 -0
- package/dist/wdio/reporter.d.ts +2 -0
- package/dist/wdio/reporter.js +46 -3
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
<p align="center"><img src="https://raw.githubusercontent.com/naveenautomationlabs/reporting-labs/main/assets/logo-wordmark.svg" alt="reportingLabs" width="320"></p>
|
|
2
2
|
|
|
3
|
+
<p align="center">
|
|
4
|
+
<a href="https://www.npmjs.com/package/reporting-labs"><img src="https://img.shields.io/npm/v/reporting-labs.svg?label=npm" alt="npm"></a>
|
|
5
|
+
<a href="https://reportinglabs.dev"><img src="https://img.shields.io/badge/docs-reportinglabs.dev-1A56DB.svg" alt="Docs"></a>
|
|
6
|
+
<a href="https://reportinglabs.dev/support"><img src="https://img.shields.io/badge/%E2%99%A5%20Support-reportingLabs-E5405E?style=flat" alt="Support reportingLabs"></a>
|
|
7
|
+
</p>
|
|
8
|
+
|
|
3
9
|
# reportingLabs
|
|
4
10
|
|
|
5
11
|
**A beautiful test report in one HTML file. It tells you what broke, who owns it, and whether it is new.**
|
|
6
12
|
|
|
7
13
|
reportingLabs turns a test run into a single HTML file. No server. No upload. No login. Open the file in a browser, attach it to a CI job, or send it on Slack or email. It just works.
|
|
8
14
|
|
|
9
|
-
Today it ships with a **Playwright** reporter
|
|
15
|
+
Today it ships with a **Playwright** reporter and a **WebdriverIO** reporter. Cypress and Jest/Vitest are on the roadmap. The same report is also available for [Java](https://github.com/naveenautomationlabs/reporting-labs-java) and [Python](https://github.com/naveenautomationlabs/reporting-labs-python).
|
|
16
|
+
|
|
17
|
+
> ♥ **Free and open source, no paid tier.** If reportingLabs saves your team time, [support its development](https://reportinglabs.dev/support) (Razorpay for India, Stripe for everywhere else). A ⭐ on GitHub helps too.
|
|
10
18
|
|
|
11
19
|
<p align="center"><img src="https://raw.githubusercontent.com/naveenautomationlabs/reporting-labs/main/docs/quickstart.gif" alt="reportingLabs in three steps: install, tag your tests, open one HTML file" width="900"></p>
|
|
12
20
|
|
|
@@ -113,6 +121,48 @@ One line per test. With this the report can rank failures by priority, group the
|
|
|
113
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`.
|
|
114
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']`.
|
|
115
123
|
|
|
124
|
+
### Or write it as a comment (your choice)
|
|
125
|
+
|
|
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 |
|
|
132
|
+
|
|
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
|
|
141
|
+
/**
|
|
142
|
+
* @priority P0 @owner naveen @feature payment @story SHOP-250
|
|
143
|
+
* @smoke
|
|
144
|
+
*/
|
|
145
|
+
test('completes purchase', async ({ page }) => {
|
|
146
|
+
// ... your test as usual
|
|
147
|
+
});
|
|
148
|
+
```
|
|
149
|
+
|
|
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).
|
|
165
|
+
|
|
116
166
|
### `log()`: a line in the report
|
|
117
167
|
|
|
118
168
|
```ts
|
|
@@ -134,7 +184,34 @@ await testData(rowsFromExcelOrJson, 'Coupons'); // arr
|
|
|
134
184
|
await testData(fs.readFileSync('data/users.csv', 'utf8'), 'users.csv'); // CSV text → table
|
|
135
185
|
```
|
|
136
186
|
|
|
137
|
-
|
|
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
|
+
```
|
|
138
215
|
|
|
139
216
|
## API calls: recorded on their own
|
|
140
217
|
|
|
@@ -260,37 +337,40 @@ Every outcome Playwright can produce, not just pass and fail:
|
|
|
260
337
|
|
|
261
338
|
## How it compares
|
|
262
339
|
|
|
263
|
-
|
|
340
|
+
✅ built in · 🟡 possible with extra setup · ❌ not in the official docs
|
|
264
341
|
|
|
265
|
-
|
|
|
342
|
+
| | Playwright HTML | Allure | **reportingLabs** |
|
|
266
343
|
|---|:---:|:---:|:---:|
|
|
267
|
-
|
|
|
268
|
-
|
|
|
269
|
-
|
|
|
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** | | | |
|
|
270
350
|
| Steps, screenshots, videos, traces | ✅ | ✅ | ✅ |
|
|
271
|
-
|
|
|
272
|
-
|
|
|
273
|
-
|
|
|
274
|
-
|
|
|
275
|
-
| Failures
|
|
276
|
-
|
|
|
277
|
-
|
|
|
278
|
-
|
|
|
279
|
-
|
|
|
280
|
-
|
|
|
281
|
-
|
|
|
282
|
-
|
|
|
283
|
-
|
|
|
284
|
-
|
|
|
285
|
-
|
|
|
286
|
-
| API calls with request/response | ❌ | 🟡 manual attachments | ✅ automatic, Copy as cURL |
|
|
287
|
-
| Logs and test data blocks | 🟡 attachments | 🟡 attachments, parameters | ✅ `log()`, `testData()` |
|
|
288
|
-
| Secrets masked | ❌ | 🟡 parameter masking | ✅ automatic |
|
|
289
|
-
| 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 | ❌ | ❌ | ✅ |
|
|
290
366
|
| Timeline by worker | ❌ | ✅ | ✅ |
|
|
291
|
-
|
|
|
292
|
-
|
|
|
293
|
-
|
|
|
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> |
|
|
294
374
|
|
|
295
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.
|
|
296
376
|
|
|
@@ -332,9 +412,10 @@ Every option is optional. `npx reporting-labs init` writes them all, with commen
|
|
|
332
412
|
| `embedFonts` | `true` | Bundle the fonts (~140 KB) so it looks the same offline |
|
|
333
413
|
| `announce` | `true` | Print the report path after the run |
|
|
334
414
|
| `open` | `'on-failure'` | Open the report in the browser after the run: `'on-failure'`, `'always'` or `'never'`. Never opens in CI |
|
|
335
|
-
| `
|
|
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 |
|
|
336
417
|
|
|
337
|
-
**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.
|
|
338
419
|
|
|
339
420
|
If your reporter list differs between CI and local, add the same line to both:
|
|
340
421
|
|
|
@@ -394,10 +475,11 @@ Three shards, run one after another (on a single machine you cannot really run t
|
|
|
394
475
|
rm -rf all-shards merged
|
|
395
476
|
|
|
396
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)
|
|
397
479
|
mkdir -p all-shards
|
|
398
|
-
npx playwright test --shard=1/3
|
|
399
|
-
npx playwright test --shard=2/3
|
|
400
|
-
npx playwright test --shard=3/3
|
|
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
|
|
401
483
|
|
|
402
484
|
# One command combines them
|
|
403
485
|
npx reporting-labs merge all-shards -o merged
|
|
@@ -422,18 +504,20 @@ That line proves the reporter ran and the folder exists to move. If you do not s
|
|
|
422
504
|
mv my-report all-shards/s1
|
|
423
505
|
```
|
|
424
506
|
|
|
425
|
-
**
|
|
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`:
|
|
426
508
|
|
|
427
509
|
```bash
|
|
428
510
|
rm -rf all-shards merged && mkdir -p all-shards
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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 &
|
|
432
514
|
wait
|
|
433
515
|
npx reporting-labs merge all-shards -o merged
|
|
434
516
|
open merged/index.html
|
|
435
517
|
```
|
|
436
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
|
+
|
|
437
521
|
#### GitHub Actions
|
|
438
522
|
|
|
439
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/cli.js
CHANGED
|
@@ -5,10 +5,21 @@ const args = process.argv.slice(2);
|
|
|
5
5
|
const cmd = args[0];
|
|
6
6
|
const has = f => args.includes(f);
|
|
7
7
|
|
|
8
|
+
/** Editor snippets (rlmeta, rltest, rlit, rldescribe) in .vscode/, so meta comments are one word + Tab away. */
|
|
9
|
+
function writeSnippets(force) {
|
|
10
|
+
const file = path.resolve('.vscode', 'reporting-labs.code-snippets');
|
|
11
|
+
if (fs.existsSync(file) && !force) return `.vscode/reporting-labs.code-snippets already exists (use --force to replace it).`;
|
|
12
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
13
|
+
fs.copyFileSync(path.join(__dirname, 'snippets.code-snippets'), file);
|
|
14
|
+
return 'Created .vscode/reporting-labs.code-snippets: in VS Code type rlmeta, rltest, rlit or rldescribe and press Tab.';
|
|
15
|
+
}
|
|
16
|
+
|
|
8
17
|
if (cmd === 'merge') {
|
|
9
18
|
const { merge, parseArgs } = require('./merge');
|
|
10
19
|
const { dirs, opts } = parseArgs(args.slice(1));
|
|
11
20
|
merge(dirs, opts);
|
|
21
|
+
} else if (cmd === 'snippets') {
|
|
22
|
+
console.log(writeSnippets(has('--force')));
|
|
12
23
|
} else if (cmd === 'init') {
|
|
13
24
|
const js = has('--js');
|
|
14
25
|
const file = path.resolve(js ? 'reporting-labs.config.js' : 'reporting-labs.config.ts');
|
|
@@ -35,12 +46,14 @@ if (cmd === 'merge') {
|
|
|
35
46
|
console.log(` import reportingLabs from './${base}';`);
|
|
36
47
|
}
|
|
37
48
|
console.log(" reporter: [['list'], ['reporting-labs', reportingLabs]],");
|
|
49
|
+
if (!has('--no-snippets')) { console.log(''); console.log(writeSnippets(false)); }
|
|
38
50
|
} else {
|
|
39
51
|
console.log(`reporting-labs
|
|
40
52
|
|
|
41
53
|
npx reporting-labs init write reporting-labs.config.ts with every option, commented
|
|
42
54
|
npx reporting-labs init --js same, as reporting-labs.config.js
|
|
43
55
|
npx reporting-labs init --force overwrite an existing config file
|
|
56
|
+
npx reporting-labs snippets add VS Code snippets: rlmeta, rltest, rlit, rldescribe (meta comments)
|
|
44
57
|
npx reporting-labs merge <dirs> combine several shard runs into one report (see 'merge --help')
|
|
45
58
|
|
|
46
59
|
Then in playwright.config.ts:
|
package/bin/config-template.txt
CHANGED
|
@@ -38,6 +38,8 @@ const config: ReportingLabsOptions = {
|
|
|
38
38
|
// announce: true, // print the report path after the run
|
|
39
39
|
// open: 'on-failure', // open the report in the browser: 'on-failure' | 'always' | 'never'; never in CI
|
|
40
40
|
// warnMissingMeta: true, // after the run, list tests that have no meta() in the console
|
|
41
|
+
// commentMeta: true, // read meta from a comment above a test: /** @owner naveen @priority P0 */ (meta() wins)
|
|
42
|
+
// pdf: true, // also write a print-ready report.pdf (false to skip, { file } to rename, { chromePath } to name the browser)
|
|
41
43
|
|
|
42
44
|
// ── Test details ─────────────────────────────────────────────────────────────
|
|
43
45
|
// Values come from meta({ priority, severity, owner, feature, epic, story, ... }) in your tests.
|
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');
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
{
|
|
2
|
+
"reportingLabs: meta comment": {
|
|
3
|
+
"scope": "javascript,typescript,javascriptreact,typescriptreact",
|
|
4
|
+
"prefix": ["rlmeta", "/**rl"],
|
|
5
|
+
"description": "reportingLabs meta as a comment above a test or describe",
|
|
6
|
+
"body": [
|
|
7
|
+
"/**",
|
|
8
|
+
" * @priority ${1|P0,P1,P2,P3,P4|} @owner ${2:name} @feature ${3:area}",
|
|
9
|
+
" * @story ${4:SHOP-123}",
|
|
10
|
+
" */"
|
|
11
|
+
]
|
|
12
|
+
},
|
|
13
|
+
"reportingLabs: Playwright test with meta": {
|
|
14
|
+
"scope": "javascript,typescript,javascriptreact,typescriptreact",
|
|
15
|
+
"prefix": "rltest",
|
|
16
|
+
"description": "A Playwright test with reportingLabs meta in a comment",
|
|
17
|
+
"body": [
|
|
18
|
+
"/**",
|
|
19
|
+
" * @priority ${1|P0,P1,P2,P3,P4|} @owner ${2:name} @feature ${3:area}",
|
|
20
|
+
" * @story ${4:SHOP-123}",
|
|
21
|
+
" */",
|
|
22
|
+
"test('${5:does something}', async ({ page }) => {",
|
|
23
|
+
"\t$0",
|
|
24
|
+
"});"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"reportingLabs: WebdriverIO it() with meta": {
|
|
28
|
+
"scope": "javascript,typescript",
|
|
29
|
+
"prefix": "rlit",
|
|
30
|
+
"description": "A WebdriverIO / Mocha test with reportingLabs meta in a comment",
|
|
31
|
+
"body": [
|
|
32
|
+
"/**",
|
|
33
|
+
" * @priority ${1|P0,P1,P2,P3,P4|} @owner ${2:name} @feature ${3:area}",
|
|
34
|
+
" * @story ${4:SHOP-123}",
|
|
35
|
+
" */",
|
|
36
|
+
"it('${5:does something}', async () => {",
|
|
37
|
+
"\t$0",
|
|
38
|
+
"});"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
"reportingLabs: describe with meta": {
|
|
42
|
+
"scope": "javascript,typescript,javascriptreact,typescriptreact",
|
|
43
|
+
"prefix": "rldescribe",
|
|
44
|
+
"description": "A describe block whose meta applies to every test inside",
|
|
45
|
+
"body": [
|
|
46
|
+
"/** @owner ${1:name} @feature ${2:area} */",
|
|
47
|
+
"${3|test.describe,describe|}('${4:Feature}', () => {",
|
|
48
|
+
"\t$0",
|
|
49
|
+
"});"
|
|
50
|
+
]
|
|
51
|
+
},
|
|
52
|
+
"reportingLabs: meta in a docstring": {
|
|
53
|
+
"scope": "python",
|
|
54
|
+
"prefix": "rlmeta",
|
|
55
|
+
"description": "reportingLabs meta in a test docstring",
|
|
56
|
+
"body": [
|
|
57
|
+
"\"\"\"${1:What this test checks}.",
|
|
58
|
+
"",
|
|
59
|
+
"@priority ${2|P0,P1,P2,P3,P4|} @owner ${3:name} @feature ${4:area}",
|
|
60
|
+
"@story ${5:SHOP-123}",
|
|
61
|
+
"\"\"\""
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"reportingLabs: pytest test with meta": {
|
|
65
|
+
"scope": "python",
|
|
66
|
+
"prefix": "rltest",
|
|
67
|
+
"description": "A pytest test with reportingLabs meta in its docstring",
|
|
68
|
+
"body": [
|
|
69
|
+
"def test_${1:does_something}(${2:page}):",
|
|
70
|
+
"\t\"\"\"${3:What this test checks}.",
|
|
71
|
+
"",
|
|
72
|
+
"\t@priority ${4|P0,P1,P2,P3,P4|} @owner ${5:name} @feature ${6:area}",
|
|
73
|
+
"\t@story ${7:SHOP-123}",
|
|
74
|
+
"\t\"\"\"",
|
|
75
|
+
"\t$0"
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meta written as a comment right above a test or describe, so a team can tag tests without calling meta():
|
|
3
|
+
*
|
|
4
|
+
* /**
|
|
5
|
+
* * @owner naveen @priority P0 @jira SHOP-12
|
|
6
|
+
* * @smoke
|
|
7
|
+
* *\/
|
|
8
|
+
* test('places an order', async ({ page }) => { ... });
|
|
9
|
+
*
|
|
10
|
+
* `@key value` pairs become meta; a bare `@word` on a line of tags becomes a tag (so `@P0` / `@critical` still set
|
|
11
|
+
* priority and severity), while a mention inside a sentence ("reported by @naveen") is ignored. Only a comment that
|
|
12
|
+
* starts its own line and touches the test line counts: a file header separated by a blank line does not.
|
|
13
|
+
* JSDoc's own tags (@param, @returns, @ts-ignore...) are ignored.
|
|
14
|
+
*/
|
|
15
|
+
export interface CommentMeta {
|
|
16
|
+
meta: Record<string, string>;
|
|
17
|
+
tags: string[];
|
|
18
|
+
}
|
|
19
|
+
/** The text of the comment that ends on the line just above `line` (1-based), or ''. */
|
|
20
|
+
export declare function commentAbove(file: string, line: number): string;
|
|
21
|
+
/** `@key value` pairs and bare `@tags` in a comment's text. A value runs to the next ` @key` or the end of the line. */
|
|
22
|
+
export declare function parseCommentMeta(text: string): CommentMeta;
|
|
23
|
+
/** Comment meta for one location, or empty. */
|
|
24
|
+
export declare function commentMetaAt(file: string, line: number): CommentMeta;
|
|
25
|
+
/** Find the line of `it('title'` / `test("title"` / `describe(`title`` in a file (WebdriverIO gives no line). */
|
|
26
|
+
export declare function lineOfTitle(file: string, title: string, kinds?: string, after?: number): number;
|
package/dist/comments.js
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.commentAbove = commentAbove;
|
|
37
|
+
exports.parseCommentMeta = parseCommentMeta;
|
|
38
|
+
exports.commentMetaAt = commentMetaAt;
|
|
39
|
+
exports.lineOfTitle = lineOfTitle;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const JSDOC = new Set(['param', 'arg', 'argument', 'returns', 'return', 'type', 'typedef', 'template', 'example', 'see', 'link',
|
|
42
|
+
'throws', 'exception', 'deprecated', 'since', 'callback', 'property', 'prop', 'override', 'private', 'public', 'protected',
|
|
43
|
+
'readonly', 'async', 'function', 'func', 'method', 'class', 'constructor', 'module', 'namespace', 'memberof', 'inheritdoc',
|
|
44
|
+
'default', 'description', 'summary', 'version', 'license', 'file', 'fileoverview', 'internal', 'ignore', 'satisfies', 'jsx',
|
|
45
|
+
'flow', 'format', 'vitest-environment', 'jest-environment']);
|
|
46
|
+
const sources = new Map();
|
|
47
|
+
function linesOf(file) {
|
|
48
|
+
if (!sources.has(file)) {
|
|
49
|
+
try {
|
|
50
|
+
sources.set(file, fs.readFileSync(file, 'utf8').split(/\r?\n/));
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
sources.set(file, null);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return sources.get(file) ?? null;
|
|
57
|
+
}
|
|
58
|
+
/** The text of the comment that ends on the line just above `line` (1-based), or ''. */
|
|
59
|
+
function commentAbove(file, line) {
|
|
60
|
+
const lines = linesOf(file);
|
|
61
|
+
if (!lines || line < 2)
|
|
62
|
+
return '';
|
|
63
|
+
let i = line - 2;
|
|
64
|
+
const at = (k) => (lines[k] ?? '').trim();
|
|
65
|
+
if (at(i).endsWith('*/')) {
|
|
66
|
+
const end = i;
|
|
67
|
+
while (i >= 0 && !at(i).includes('/*'))
|
|
68
|
+
i--;
|
|
69
|
+
if (i < 0 || !at(i).startsWith('/*'))
|
|
70
|
+
return ''; // `foo(); /* x */` belongs to the code, not the test
|
|
71
|
+
return lines.slice(i, end + 1).join('\n')
|
|
72
|
+
.replace(/^\s*\/\*+/, '').replace(/\*+\/\s*$/, '')
|
|
73
|
+
.split('\n').map(l => l.replace(/^\s*\*+ ?/, '')).join('\n');
|
|
74
|
+
}
|
|
75
|
+
if (at(i).startsWith('//')) {
|
|
76
|
+
const out = [];
|
|
77
|
+
while (i >= 0 && at(i).startsWith('//')) {
|
|
78
|
+
out.unshift(at(i).replace(/^\/\/+\s?/, ''));
|
|
79
|
+
i--;
|
|
80
|
+
}
|
|
81
|
+
return out.join('\n');
|
|
82
|
+
}
|
|
83
|
+
return '';
|
|
84
|
+
}
|
|
85
|
+
/** `@key value` pairs and bare `@tags` in a comment's text. A value runs to the next ` @key` or the end of the line. */
|
|
86
|
+
function parseCommentMeta(text) {
|
|
87
|
+
const meta = {};
|
|
88
|
+
const tags = [];
|
|
89
|
+
for (const line of text.split('\n')) {
|
|
90
|
+
// a bare @word is a tag only on a line of tags (` * @smoke @regression`), never a mention in a sentence
|
|
91
|
+
const tagLine = line.trim().startsWith('@');
|
|
92
|
+
const re = /(?:^|\s)@([A-Za-z][\w.-]*)(?:[ \t]*[:=][ \t]*|[ \t]+(?!@))?(.*?)(?=\s+@[A-Za-z][\w.-]*|$)/g;
|
|
93
|
+
let m;
|
|
94
|
+
while ((m = re.exec(line))) {
|
|
95
|
+
const key = m[1];
|
|
96
|
+
if (JSDOC.has(key.toLowerCase()) || /^(ts-|eslint|jsx|prettier)/i.test(key))
|
|
97
|
+
continue;
|
|
98
|
+
// `@owner 'naveen'` / `@feature "Cart and checkout"`: the quotes are not part of the value
|
|
99
|
+
const value = m[2].trim().replace(/^(['"`])(.*)\1$/, '$2').trim();
|
|
100
|
+
if (value)
|
|
101
|
+
meta[key.toLowerCase()] = value;
|
|
102
|
+
else if (tagLine && !tags.includes('@' + key))
|
|
103
|
+
tags.push('@' + key);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { meta, tags };
|
|
107
|
+
}
|
|
108
|
+
/** Comment meta for one location, or empty. */
|
|
109
|
+
function commentMetaAt(file, line) {
|
|
110
|
+
const text = commentAbove(file, line);
|
|
111
|
+
return text ? parseCommentMeta(text) : { meta: {}, tags: [] };
|
|
112
|
+
}
|
|
113
|
+
/** Find the line of `it('title'` / `test("title"` / `describe(`title`` in a file (WebdriverIO gives no line). */
|
|
114
|
+
function lineOfTitle(file, title, kinds = 'it|test|specify|describe|context|suite', after = 0) {
|
|
115
|
+
const lines = linesOf(file);
|
|
116
|
+
if (!lines || !title)
|
|
117
|
+
return 0;
|
|
118
|
+
const esc = title.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
119
|
+
const re = new RegExp(`\\b(?:${kinds})(?:\\.\\w+)*\\s*\\(\\s*(['"\`])${esc}\\1`);
|
|
120
|
+
// search after the enclosing describe's line, so two describes with an it('logs in') each find their own
|
|
121
|
+
for (let i = Math.max(0, after); i < lines.length; i++)
|
|
122
|
+
if (re.test(lines[i]))
|
|
123
|
+
return i + 1;
|
|
124
|
+
return 0;
|
|
125
|
+
}
|
package/dist/reporter.d.ts
CHANGED
|
@@ -45,6 +45,8 @@ export default class ReportingLabsReporter implements Reporter {
|
|
|
45
45
|
* An object value (meta({ octaneTestCase: { id, p } })) is folded to its display text and, when the key has a
|
|
46
46
|
* link template, to a ready-made href in `links`; the other fields never show in the report.
|
|
47
47
|
*/
|
|
48
|
+
/** Meta from comments above the test and its describe blocks (outer first, the test's own comment last). */
|
|
49
|
+
private commentMeta;
|
|
48
50
|
private extractMeta;
|
|
49
51
|
/** A local image file (path relative to the config) is embedded as a data URI so the report stays self-contained. URLs and data URIs pass through. */
|
|
50
52
|
private resolveLogo;
|
package/dist/reporter.js
CHANGED
|
@@ -45,6 +45,7 @@ const template_1 = require("./template");
|
|
|
45
45
|
const mask_1 = require("./mask");
|
|
46
46
|
const explain_1 = require("./explain");
|
|
47
47
|
const pdf_1 = require("./pdf");
|
|
48
|
+
const comments_1 = require("./comments");
|
|
48
49
|
const DEFAULT_EMBED_LIMIT = 2 * 1024 * 1024;
|
|
49
50
|
/** Attach steps created by log() and the automatic API capture; the data shows in its own section, so hide the step. */
|
|
50
51
|
function isInternalAttach(s) {
|
|
@@ -86,7 +87,9 @@ class ReportingLabsReporter {
|
|
|
86
87
|
const scalar = (name, current) => { const v = process.env['REPORTING_LABS_' + name]; return v && v.trim() ? v.trim() : current; };
|
|
87
88
|
this.options = { ...options, metadata,
|
|
88
89
|
title: scalar('TITLE', options.title), theme: scalar('THEME', options.theme), palette: scalar('PALETTE', options.palette),
|
|
89
|
-
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) };
|
|
90
93
|
this.masker = (0, mask_1.makeMasker)(options.maskKeys ?? [], { knownValues: options.maskValues ?? [], fromEnv: options.maskFromEnv !== false });
|
|
91
94
|
}
|
|
92
95
|
printsToStdio() { return false; }
|
|
@@ -135,7 +138,8 @@ class ReportingLabsReporter {
|
|
|
135
138
|
const last = test.results[test.results.length - 1];
|
|
136
139
|
const resultAnn = (last?.annotations ?? []);
|
|
137
140
|
const annotations = [...test.annotations, ...resultAnn.filter(a => !test.annotations.some(b => b.type === a.type && b.description === a.description))];
|
|
138
|
-
const
|
|
141
|
+
const fromComments = this.commentMeta(test);
|
|
142
|
+
const extracted = this.extractMeta(test, fromComments);
|
|
139
143
|
tests.push({
|
|
140
144
|
id: test.id,
|
|
141
145
|
key: `${project}::${file}::${[...titlePath, test.title].join(' › ')}${test.repeatEachIndex ? ' #' + (test.repeatEachIndex + 1) : ''}`,
|
|
@@ -145,7 +149,7 @@ class ReportingLabsReporter {
|
|
|
145
149
|
line: test.location.line,
|
|
146
150
|
column: test.location.column,
|
|
147
151
|
project,
|
|
148
|
-
tags: test.tags,
|
|
152
|
+
tags: [...test.tags, ...fromComments.tags.filter(g => !test.tags.includes(g))],
|
|
149
153
|
annotations,
|
|
150
154
|
meta: extracted.meta,
|
|
151
155
|
links: Object.keys(extracted.links).length ? extracted.links : undefined,
|
|
@@ -273,7 +277,8 @@ class ReportingLabsReporter {
|
|
|
273
277
|
console.log(` ${(t.file + ':' + t.line).padEnd(w)} ${t.title}`);
|
|
274
278
|
if (missing.length > show.length)
|
|
275
279
|
console.log(` … and ${missing.length - show.length} more`);
|
|
276
|
-
console.log(" Add meta({ priority: 'P1', owner: 'name', feature: 'area' }) at the top of the test
|
|
280
|
+
console.log(" Add meta({ priority: 'P1', owner: 'name', feature: 'area' }) at the top of the test, or a comment right above it:");
|
|
281
|
+
console.log(" /** @priority P1 @owner name @feature area */. Set warnMissingMeta: false to hide this.");
|
|
277
282
|
}
|
|
278
283
|
/** Open the report in the default browser, like Playwright's HTML reporter. Never in CI. */
|
|
279
284
|
maybeOpen(file, result) {
|
|
@@ -423,12 +428,36 @@ class ReportingLabsReporter {
|
|
|
423
428
|
* An object value (meta({ octaneTestCase: { id, p } })) is folded to its display text and, when the key has a
|
|
424
429
|
* link template, to a ready-made href in `links`; the other fields never show in the report.
|
|
425
430
|
*/
|
|
426
|
-
|
|
431
|
+
/** Meta from comments above the test and its describe blocks (outer first, the test's own comment last). */
|
|
432
|
+
commentMeta(test) {
|
|
433
|
+
const out = { meta: {}, tags: [] };
|
|
434
|
+
if (this.options.commentMeta === false)
|
|
435
|
+
return out;
|
|
436
|
+
try {
|
|
437
|
+
const dims = this.metaKeys();
|
|
438
|
+
const at = [];
|
|
439
|
+
for (let s = test.parent; s; s = s.parent)
|
|
440
|
+
if (s.type === 'describe' && s.location)
|
|
441
|
+
at.unshift(s.location);
|
|
442
|
+
at.push(test.location);
|
|
443
|
+
for (const loc of at) {
|
|
444
|
+
const c = (0, comments_1.commentMetaAt)(loc.file, loc.line);
|
|
445
|
+
Object.assign(out.meta, c.meta);
|
|
446
|
+
// a meta key left without a value (`@priority`) is not a tag
|
|
447
|
+
for (const g of c.tags)
|
|
448
|
+
if (!out.tags.includes(g) && !dims.includes(g.slice(1).toLowerCase()))
|
|
449
|
+
out.tags.push(g);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
catch { /* comments are a convenience: never fail the report over them */ }
|
|
453
|
+
return out;
|
|
454
|
+
}
|
|
455
|
+
extractMeta(test, fromComments = { meta: {}, tags: [] }) {
|
|
427
456
|
const dims = this.metaKeys();
|
|
428
457
|
const meta = {};
|
|
429
458
|
const links = {};
|
|
430
|
-
// Tags first (describe-level, then test-level),
|
|
431
|
-
for (const raw of test.tags) {
|
|
459
|
+
// Tags first (describe-level, then test-level), then comments, then annotations: meta() in the code wins.
|
|
460
|
+
for (const raw of [...test.tags, ...fromComments.tags]) {
|
|
432
461
|
const tag = raw.replace(/^@/, '');
|
|
433
462
|
const m = tag.match(/^([a-z_-]+)[:=](.+)$/i);
|
|
434
463
|
if (m && dims.includes(m[1].toLowerCase())) {
|
|
@@ -440,6 +469,9 @@ class ReportingLabsReporter {
|
|
|
440
469
|
if (/^(blocker|critical|major|minor|trivial)$/i.test(tag) && dims.includes('severity') && !meta.severity)
|
|
441
470
|
meta.severity = tag.toLowerCase();
|
|
442
471
|
}
|
|
472
|
+
for (const [k, v] of Object.entries(fromComments.meta))
|
|
473
|
+
if (dims.includes(k))
|
|
474
|
+
meta[k] = v;
|
|
443
475
|
for (const a of test.annotations) {
|
|
444
476
|
const k = a.type.toLowerCase();
|
|
445
477
|
if (!dims.includes(k) || !a.description)
|
package/dist/template.html
CHANGED
|
@@ -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
|
|
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
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
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)+'">
|
|
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
|
|
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
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
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)+'">
|
|
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
|
@@ -27,6 +27,9 @@ export interface ReportingLabsOptions {
|
|
|
27
27
|
file?: string;
|
|
28
28
|
chromePath?: string;
|
|
29
29
|
};
|
|
30
|
+
/** Read meta from a comment right above a test or describe: `/** @owner naveen @priority P0 *\/`. `@key value`
|
|
31
|
+
* pairs become meta, a bare `@word` a tag; meta() in the test wins. Default: true */
|
|
32
|
+
commentMeta?: boolean;
|
|
30
33
|
/** Inline screenshots as base64 (single file, opens anywhere). Default: true */
|
|
31
34
|
embedAttachments?: boolean;
|
|
32
35
|
/** Max size (bytes) of a single attachment to embed. Larger ones are copied as files. Default: 2 MB */
|
|
@@ -313,6 +316,14 @@ export interface ReportData {
|
|
|
313
316
|
current: number;
|
|
314
317
|
total: number;
|
|
315
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
|
+
}>;
|
|
316
327
|
options: {
|
|
317
328
|
logo?: string;
|
|
318
329
|
accent?: string;
|
package/dist/wdio/reporter.d.ts
CHANGED
|
@@ -19,6 +19,8 @@ export interface ReportingLabsWdioOptions {
|
|
|
19
19
|
maskKeys?: string[];
|
|
20
20
|
maskValues?: string[];
|
|
21
21
|
maskFromEnv?: boolean;
|
|
22
|
+
/** Read meta from a comment right above it() / describe(): `/** @owner naveen @priority P0 *\/`. Default: true */
|
|
23
|
+
commentMeta?: boolean;
|
|
22
24
|
[k: string]: unknown;
|
|
23
25
|
}
|
|
24
26
|
export default class ReportingLabsWdioReporter extends EventEmitter {
|
package/dist/wdio/reporter.js
CHANGED
|
@@ -52,6 +52,8 @@ const fs = __importStar(require("fs"));
|
|
|
52
52
|
const path = __importStar(require("path"));
|
|
53
53
|
const mask_1 = require("../mask");
|
|
54
54
|
const explain_1 = require("../explain");
|
|
55
|
+
const comments_1 = require("../comments");
|
|
56
|
+
const url_1 = require("url");
|
|
55
57
|
const META_KEYS = ['priority', 'severity', 'feature', 'owner', 'epic', 'story', 'issue', 'bug', 'component', 'module', 'team', 'sprint', 'testcase', 'tms', 'requirement'];
|
|
56
58
|
exports.META_KEYS = META_KEYS;
|
|
57
59
|
/** WebDriver command name → readable step verb. Commands not listed (reads, internals) are not steps. */
|
|
@@ -121,14 +123,43 @@ class ReportingLabsWdioReporter extends node_events_1.EventEmitter {
|
|
|
121
123
|
retry: test.retries || 0, status: 'passed', duration: 0, startTime: now, workerIndex: numericCid(this.cid),
|
|
122
124
|
errors: [], steps: [], attachments: [], stdout: [], stderr: [], logs: [], data: [], api: [],
|
|
123
125
|
};
|
|
124
|
-
const
|
|
126
|
+
const abs = srcPath(test.file || this.specs[0] || '');
|
|
127
|
+
const file = this.rel(abs);
|
|
125
128
|
const tagSource = [test.title || '', ...this.suiteStack].join(' ');
|
|
126
|
-
const tags =
|
|
129
|
+
const tags = tagSource.match(/@[A-Za-z][\w:.=-]*/g) || [];
|
|
130
|
+
// WDIO gives no line numbers: find it('title') in the spec, for the source link and the comment above it
|
|
131
|
+
// Each describe is looked up after the one around it, then the test after its own describe.
|
|
132
|
+
const at = [];
|
|
133
|
+
let from = 0;
|
|
134
|
+
for (const st of this.suiteStack) {
|
|
135
|
+
const ln = abs ? (0, comments_1.lineOfTitle)(abs, st, 'describe|context|suite', from) : 0;
|
|
136
|
+
if (ln) {
|
|
137
|
+
at.push(ln);
|
|
138
|
+
from = ln;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const line = abs ? (0, comments_1.lineOfTitle)(abs, test.title || '', 'it|test|specify', from) : 0;
|
|
142
|
+
const fromComments = {};
|
|
143
|
+
if (abs && this.options.commentMeta !== false) {
|
|
144
|
+
try {
|
|
145
|
+
for (const ln of [...at, line].filter(Boolean)) {
|
|
146
|
+
const c = (0, comments_1.commentMetaAt)(abs, ln);
|
|
147
|
+
Object.assign(fromComments, c.meta);
|
|
148
|
+
for (const g of c.tags)
|
|
149
|
+
if (!tags.includes(g) && !META_KEYS.includes(g.slice(1).toLowerCase()))
|
|
150
|
+
tags.push(g);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch { /* comments are a convenience: never fail the run over them */ }
|
|
154
|
+
}
|
|
127
155
|
const { meta } = metaFromTags(tags, META_KEYS);
|
|
156
|
+
for (const [k, v] of Object.entries(fromComments))
|
|
157
|
+
if (META_KEYS.includes(k))
|
|
158
|
+
meta[k] = this.masker.maskStr(v);
|
|
128
159
|
const t = {
|
|
129
160
|
id: test.uid || `${file}:${test.title}`,
|
|
130
161
|
key: '', title: this.masker.maskStr(test.title || ''), path: this.suiteStack.map(s => this.masker.maskStr(s)),
|
|
131
|
-
file, line
|
|
162
|
+
file, line, project: this.capsName, tags, annotations: [], meta,
|
|
132
163
|
outcome: 'passed', duration: 0, results: [result], retries: test.retries,
|
|
133
164
|
};
|
|
134
165
|
t.key = `${t.project}::${t.file}::${[...t.path, t.title].join(' › ')}`;
|
|
@@ -237,6 +268,7 @@ class ReportingLabsWdioReporter extends node_events_1.EventEmitter {
|
|
|
237
268
|
catch { /* best-effort; finalize will simply see fewer parts */ }
|
|
238
269
|
}
|
|
239
270
|
rel(file) {
|
|
271
|
+
file = srcPath(file);
|
|
240
272
|
if (!file)
|
|
241
273
|
return file;
|
|
242
274
|
try {
|
|
@@ -330,3 +362,14 @@ function metaFromTags(tags, dims) {
|
|
|
330
362
|
}
|
|
331
363
|
return { meta, clean };
|
|
332
364
|
}
|
|
365
|
+
/** A spec path WDIO may hand over as a file:// URL. */
|
|
366
|
+
function srcPath(f) {
|
|
367
|
+
if (!f.startsWith('file:'))
|
|
368
|
+
return f;
|
|
369
|
+
try {
|
|
370
|
+
return (0, url_1.fileURLToPath)(f);
|
|
371
|
+
}
|
|
372
|
+
catch {
|
|
373
|
+
return f;
|
|
374
|
+
}
|
|
375
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reporting-labs",
|
|
3
|
-
"version": "0.6.
|
|
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",
|
|
@@ -71,6 +71,10 @@
|
|
|
71
71
|
"bugs": {
|
|
72
72
|
"url": "https://github.com/naveenautomationlabs/reporting-labs/issues"
|
|
73
73
|
},
|
|
74
|
+
"funding": {
|
|
75
|
+
"type": "individual",
|
|
76
|
+
"url": "https://reportinglabs.dev/support"
|
|
77
|
+
},
|
|
74
78
|
"engines": {
|
|
75
79
|
"node": ">=18"
|
|
76
80
|
},
|