playwright-performance-regression 0.1.0-next.1 → 0.1.0-next.4

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.
Files changed (41) hide show
  1. package/CHANGELOG.md +431 -0
  2. package/README.md +96 -64
  3. package/dist/{chunk-L5C63HEF.js → chunk-CISGJCFW.js} +378 -48
  4. package/dist/chunk-CXE5IWZY.js +1648 -0
  5. package/dist/{chunk-B64P2D5A.js → chunk-E2IX265O.js} +395 -206
  6. package/dist/chunk-IUI4AFE5.cjs +658 -0
  7. package/dist/{chunk-WZVQK7CQ.cjs → chunk-KELMALEG.cjs} +408 -218
  8. package/dist/{chunk-GCA73FFP.cjs → chunk-LUA4WRIQ.cjs} +382 -47
  9. package/dist/chunk-RL27E3AB.js +595 -0
  10. package/dist/{chunk-DYLCGMI2.js → chunk-S6UH6QPK.js} +6 -1
  11. package/dist/cli.js +2761 -2339
  12. package/dist/config.cjs +122 -137
  13. package/dist/config.d.cts +3 -2
  14. package/dist/config.d.ts +3 -2
  15. package/dist/config.js +117 -132
  16. package/dist/fixture.cjs +9 -5
  17. package/dist/fixture.d.cts +10 -4
  18. package/dist/fixture.d.ts +10 -4
  19. package/dist/fixture.js +4 -4
  20. package/dist/index.cjs +3 -3
  21. package/dist/index.d.cts +121 -25
  22. package/dist/index.d.ts +121 -25
  23. package/dist/index.js +1 -1
  24. package/dist/perf-api-2DH_keLh.d.cts +17 -0
  25. package/dist/perf-api-2DH_keLh.d.ts +17 -0
  26. package/dist/reporter.cjs +5713 -1237
  27. package/dist/reporter.js +6905 -693
  28. package/dist/test.cjs +4 -4
  29. package/dist/test.js +4 -4
  30. package/package.json +19 -1
  31. package/schemas/common.schema.json +2 -2
  32. package/schemas/config.schema.json +72 -26
  33. package/schemas/outcome.schema.json +2 -2
  34. package/schemas/run-report.schema.json +549 -20
  35. package/schemas/samples.schema.json +48 -37
  36. package/schemas/thresholds.schema.json +1 -1
  37. package/dist/chunk-3CLCMD2Q.js +0 -3411
  38. package/dist/chunk-4SFI55HF.cjs +0 -319
  39. package/dist/chunk-HBGADXLP.js +0 -254
  40. package/dist/perf-api-V4PeHVE0.d.cts +0 -22
  41. package/dist/perf-api-V4PeHVE0.d.ts +0 -22
package/CHANGELOG.md CHANGED
@@ -7,6 +7,437 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.1.0-next.4] - 2026-11-23
11
+
12
+ Upgrading from `0.1.0-next.3`: see [Upgrading](docs/upgrading.md). In short, run your test
13
+ command with `PW_PERF_*` variables instead of `pw-perf` commands, move `pw-perf-results/` to
14
+ `reports/pw-perf/`, remove `run.projects` and `--reporter` from the measurement command, and
15
+ re-derive the thresholds files (the keys changed).
16
+
17
+ ### Breaking
18
+
19
+ - **No commands or options, only variables.** The `pw-perf` commands and options are gone:
20
+ `pw-perf test`, `thresholds`, `check`, `report`, `init`, `thresholds --from`, `--env`,
21
+ `--passes`, `--prune`, `--max-tests`, `--config`, `--input`, `--output`, `--help` and
22
+ `--version`. Run your test command with the variables instead, e.g.
23
+ `PW_PERF_MODE=test PW_PERF_PASSES=3 npx playwright test`. Every run writes the HTML report, so
24
+ there is no command to render it again; thresholds come from a `PW_PERF_MODE=thresholds` run (the
25
+ CI thresholds job and its artifact). The runner codes (`CLI_INVALID_OPTION`,
26
+ `CLI_OUTCOME_MISSING`, `CONFIG_FILE_LOAD_FAILED`, …) are removed. `perf:*` scripts written by an
27
+ early wizard no longer work; remove them. Hints, the help, the `Next:` line, the wizard, the
28
+ README and `docs/` show only `PW_PERF_*=… <your test command>`; `docs/cli.md` is now "Running".
29
+ - **The wizard takes no options.** `npx pw-perf` without arguments starts it in a project with the
30
+ package installed, and `npm init playwright-performance-regression` takes no arguments either
31
+ (any argument is `CLI_UNKNOWN_COMMAND` with the help). Use `PW_PERF_LANG=<code>` instead of
32
+ `--lang`, `PW_PERF_DRY_RUN=1` instead of `--dry-run` and `PW_PERF_NO_TUTORIAL=1` instead of
33
+ `--no-tutorial`. `--yes` has no replacement: the wizard writes changes only in a terminal (press
34
+ Enter for each default); without one it shows the plan.
35
+ - **`run.projects` is gone.** The measured projects are the ones your test command selects
36
+ (`--project`; all projects without it), except setup and teardown projects (named in
37
+ `dependencies` or `teardown` of another project), which run once per pass and are not measured.
38
+ `withPerf()` no longer removes projects from the run and the browser engine no longer decides:
39
+ select one engine with `--project`, e.g. `PW_PERF_MODE=test npx playwright test --project
40
+ chromium` (samples of several engines give `STATS_MULTIPLE_BROWSERS`). `run.projects` in the
41
+ config is `CONFIG_UNKNOWN_OPTION`; `CONFIG_UNKNOWN_PROJECT` and `CONFIG_MULTIPLE_ENGINES` are
42
+ removed, and `CONFIG_NO_MEASURED_PROJECT` now comes from the reporter when the command runs only
43
+ setup or teardown projects. Run reports have `schemaVersion` 4; version 3 reports are migrated
44
+ (their `config.run.projects` is dropped).
45
+ - **Report folder `reports/pw-perf/`.** The default `report.dir` is now `reports/pw-perf/` (was
46
+ `pw-perf-results/`); `report.html`, `report.json`, `outcome.json`, `pass-<k>.json` and
47
+ `thresholds-diff.md` are written directly into it. Every `test` and `thresholds` run empties it
48
+ when its first test starts, so reports of earlier runs never stay next to the new ones; the
49
+ parent `reports/` folder and the reports of other tools in it are never touched. A guard keeps
50
+ the folder when it is the project directory, the `playwright.config` directory, the home
51
+ directory, the filesystem root, `thresholds.dir`, a folder containing one of them, or a folder
52
+ with thresholds files, `package.json`, `playwright.config.*` or `.git`; the run then warns with
53
+ `RUN_REPORT_DIR_NOT_CLEANED`. A check and a run without started tests remove nothing. To
54
+ migrate: replace `pw-perf-results` with `reports/pw-perf` in `.gitignore` and in your CI jobs
55
+ (the artifact path and the `outcome.json` path; the GitHub and Azure artifact is now named
56
+ `pw-perf-report`), and delete the old `pw-perf-results/` folder, or set
57
+ `report: { dir: 'pw-perf-results' }` to keep it.
58
+ - **Endpoint and step keys changed** (F2 findings). Prefixed ids in URLs are replaced with `:id` by
59
+ the new built-in pattern `keys.idPatterns.prefixed`: 2–5 capital letters, `-` and at least 3
60
+ digits (`/orders/ORD-1000` → `/orders/:id`), or 1–8 lowercase letters, `_` and at least 2 digits
61
+ or 8–32 letters and digits with a digit (`/invoices/inv_58` → `/invoices/:id`); short names such
62
+ as `api_v2`, `step_2fa` or `UTF-8` stay. In step titles, bare integers shorter than 9 digits
63
+ become `:num` instead of `:id` (`Transfer 1500 PLN` → `Transfer :num PLN`, the same key as
64
+ `Transfer 120.50 PLN`); number segments of paths in titles stay `:id`. Both fingerprints change,
65
+ so existing thresholds files give `THRESHOLDS_SOURCE_MISMATCH` until re-derived; see
66
+ [Upgrading](docs/upgrading.md#from-010-next3-endpoint-and-step-keys-changed).
67
+ - **`--reporter` stops a measurement run.** A `--reporter` option without the pw-perf reporter in
68
+ the test command (also in an npm script) now stops a `PW_PERF_MODE=test` or `thresholds` run
69
+ before the tests with exit code 1 (`RUN_REPORTER_FLAG`). It used to be a warning on stderr and
70
+ the run ended with exit code 0 although nothing was measured. A check still only warns. Remove
71
+ `--reporter` from the measurement command or add `,playwright-performance-regression/reporter`
72
+ to its value.
73
+ - **`test.step` blocks are measured by default** (`measure.steps` is `true`): they give step keys,
74
+ a `pw-perf-thresholds.steps.json` file and fail the run like endpoints, without any config. Set
75
+ `measure: { steps: false }` to measure only backend requests. A run without any `test.step`
76
+ prints one informational line instead of the `STEPS_NONE_FOUND` warning, which is removed.
77
+ - **No start question.** The `Continue? (Y/n)` question under the start banner is gone, and so is
78
+ `PW_PERF_YES`: the banner only informs and the run starts right away in every mode (press Ctrl+C
79
+ to stop it). A set `PW_PERF_YES` is ignored.
80
+
81
+ ### Added
82
+
83
+ - **`request` calls are measured.** Calls of Playwright's `request` fixture, `page.request` and
84
+ `context.request` (API tests and data setup in UI tests) are measured with `measure.api` on (the
85
+ default). They get their own keys with the prefix `request`, e.g.
86
+ `request GET /api/orders/:id`, next to the browser's `GET /api/orders/:id`: the two are timed
87
+ differently (worker clock vs browser timing), so each gets its own entry in
88
+ `pw-perf-thresholds.json` and its own limits. Contexts from `playwright.request.newContext()` are
89
+ measured after `perf.trackRequestContext(context)` or `trackRequestContext(context)` from
90
+ `playwright-performance-regression/fixture`. API tests must import `test` from the wrapped test
91
+ object, otherwise `TESTS_NOT_INSTRUMENTED` names them. The sample batch attachment moves to
92
+ schema version 3 (`apiRequests`); the run report and the thresholds files keep their versions.
93
+ If you excluded API-only projects from the measurement command because of
94
+ `RUN_PROJECT_NO_REQUESTS`, you can add them back.
95
+ - `measure.api` (default `true`): set it to `false` to measure only `test.step` durations. No
96
+ request is recorded, the endpoint thresholds file is neither read nor written, and tests do not
97
+ need to import `test` from a wrapped test object (no `TESTS_NOT_INSTRUMENTED`). Turning off both
98
+ `measure.api` and `measure.steps` is `CONFIG_INVALID_VALUE`.
99
+ - `run.overrideSlowMo` (default `false`): when `true`, perf mode sets `use.launchOptions.slowMo`
100
+ to 0 in every measured project and lists `slowMo` in the "perf mode overrides …" line. With
101
+ `false`, the `CONFIG_SLOW_MO` warning stays and now points to the option.
102
+ - Wizard, new and changed steps (`[n/10]`):
103
+ - right after the language question it checks for `playwright.config`; without one it lists the
104
+ configs it finds in subfolders (up to 3 levels) with `cd <folder> && npx pw-perf` for each;
105
+ - step 1 says what the package does, how to run it (`PW_PERF_MODE=thresholds <your test
106
+ command>`, commit the thresholds files, then `PW_PERF_MODE=test <your test command>` locally
107
+ and in CI, with `--project <name>` to measure one browser), the other `PW_PERF_*` variables
108
+ and which files to commit, instead of listing what it detected; the Playwright version shows
109
+ up only as an error when it is too old;
110
+ - step 4 asks "What to measure? [all/api/steps]" in every project, also without `test.step`
111
+ calls: `all` (the default) keeps both kinds on, `api` writes `measure: { steps: false }` and
112
+ `steps` writes `measure: { api: false }`; the `api` lesson says that it also covers `request`
113
+ calls in API tests;
114
+ - step 6 asks for your usual test command, with the plain Playwright command of your package
115
+ manager as the default (Enter) and `skip` to skip the check; it suggests `npm run <script>`
116
+ (or the pnpm/yarn form) when exactly one `package.json` script runs `playwright test`, and
117
+ warns when the command or its script sets `--reporter` or runs other commands before
118
+ `playwright test`, since they run in every pass. The typed command is used as typed in the
119
+ summary commands, in the CI jobs (quoted for GitLab YAML and Jenkins Groovy) and for the
120
+ check. The wizard no longer asks which test script runs your tests (`INIT_SCRIPT_FLAG` and
121
+ `INIT_SCRIPT_LATER_STEPS` are removed);
122
+ - when the tests take `test` straight from `@playwright/test` and there is no fixtures module,
123
+ the changes step rewrites the imports of the test files: `test` and `expect` come from
124
+ `playwright-performance-regression/test`, other names stay. Each file is a diff you confirm;
125
+ setup files are left alone. The red box appears only when you decline one of them;
126
+ - step 9, the check, runs your test command like the real runs: first with
127
+ `PW_PERF_MODE=thresholds`, then with `PW_PERF_MODE=test`, both with `PW_PERF_PASSES=2`,
128
+ through your shell. Its thresholds go to a temporary folder that is deleted afterwards (your
129
+ thresholds files are not touched), a key needs only 2 successful samples, and the wizard shows
130
+ the exit code of each run and the most likely cause of a failure from `outcome.json`. There is
131
+ no check when the red "Action needed: nothing is measured yet" box is shown (with the answer
132
+ `steps` there is no red box, because steps are measured without the `perf` fixture);
133
+ - the wizard says that `globalSetup` and setup projects run once per pass, warns about
134
+ `request.newContext()` contexts that are not passed to `trackRequestContext()`, warns about
135
+ test files that still import `test` straight from `@playwright/test` after wrapping your
136
+ fixtures module, and reminds you to format the changed files.
137
+ - The wizard writes `pw-perf.config.js` in a JavaScript project (a `playwright.config.js`,
138
+ `.mjs` or `.cjs` without `tsconfig.json`): an ES module or CommonJS like the Playwright config,
139
+ with `// @ts-check`. A CommonJS config requires it without `.default`. TypeScript projects keep
140
+ `pw-perf.config.ts`.
141
+ - Warning `CONFIG_FILE_NOT_PASSED`: a `pw-perf.config.*` file next to the Playwright config is no
142
+ longer ignored silently when `withPerf(config)` gets no second argument; the run still uses the
143
+ defaults, and the hint shows how to pass the file.
144
+ - HTML report: a stopwatch logo in the header and as the page icon (an inline `data:` URI, no
145
+ extra files); a Source column (`browser` / `request`) in the Endpoints table.
146
+ - The report names what it is about: the run report has an optional `suite` (the package name from
147
+ `package.json` next to the Playwright config, else the config path from the repository root),
148
+ shown in the HTML header, the page title and Run & config. A measured project with only
149
+ `request` calls is marked `requestOnly` and reads "no browser" in Run & config and in the
150
+ `PW_PERF_MODE=check` output.
151
+ - Docs: installing in a pnpm monorepo (`pnpm add -Dw` or in every importing package,
152
+ `pnpm --filter <app> exec playwright test`, `--no-bail` for `pnpm -r`), `globalSetup` and setup
153
+ projects running once per pass, `trackRequestContext()` in fixtures, several test objects in one
154
+ chain (wrapping both is safe: an integration test shows every request is recorded once), an
155
+ example of `keys.extraIdPatterns`, and the upgrade steps from `0.1.0-next.3`.
156
+
157
+ ### Changed
158
+
159
+ - `pw-perf.config.ts` written by the wizard is short: the 15 most important options (including
160
+ `measure.api`, `measure.steps` and `run.overrideSlowMo`), each with a short comment, and a link
161
+ to the full option list in `docs/configuration.md`. The "Most important settings" block and the
162
+ comments for every other option are gone.
163
+ - The wizard's commands and CI jobs use your test command from step 6, or the plain Playwright
164
+ command of your package manager (`npx playwright test`, `pnpm exec playwright test`,
165
+ `yarn playwright test`); it adds `reports/pw-perf/` to `.gitignore` unless `reports/` is
166
+ ignored already.
167
+ - The wizard's red box lists the files with `.extend()` with the number of test files that import
168
+ each, the most imported first, and names the one to wrap. A fixtures module of a workspace
169
+ package is listed too, with a note to install the package in the workspace root. Nested git
170
+ repositories (submodules) are no longer scanned unless your sources import from them.
171
+ - HTML report: the view switch (Overview, Endpoints, Steps, Tests, …) is a row of tabs. The
172
+ selected tab has an accent underline and background, every tab is at least 44 px high, and on a
173
+ narrow screen the bar scrolls to show the selected tab. The Endpoints and Steps tab counts are
174
+ neutral with a red badge of keys with violations.
175
+ - HTML report details: a key without timed samples shows its other statuses under Samples and in
176
+ its details, e.g. "5 × 404 (not timed)"; the thresholds file source is shortened to the version
177
+ and the date (full text on hover); Top keys in the Tests tab put the time under each key; "Most
178
+ expensive tests" names the project when more than one is measured; the TTFB column is hidden
179
+ when no key has TTFB; a step without a location reads "boxed step (no location)".
180
+ - Violations are counted the same way in the console and the HTML report: failed checks with the
181
+ number of keys (`8 blocking violations in 7 keys`); the Violations tile counts failed checks
182
+ too. Apdex, slow share (wilson) and error rate over the limit read in percentage points
183
+ (`+81 pp`) instead of a relative percent that showed `>999%`.
184
+ - `Next:` after a `test` or `check` run repeats the arguments you added (`PW_PERF_MODE=test npm
185
+ run e2e -- --project=desktop`); the thresholds command stays without them, so thresholds come
186
+ from the whole suite. When the package manager was called from a parent directory (e.g. the
187
+ root of a monorepo), the command starts with `cd <directory> && `.
188
+ - The start banner no longer guesses 30 s per test before the first run: the estimate says
189
+ `unknown (run PW_PERF_MODE=check for an estimate)`. A time under a minute reads `< 1 min`
190
+ without `≈`, and there is no `Tip` when `run.grep` is set.
191
+ - The line of a later pass shows your command (`pass 2/10: npx playwright test`,
192
+ `pass 2/10: npm run e2e -- --grep cart`) instead of the full paths of the process.
193
+ - The `Outcome:` line starts with the exit code of the process: `Outcome: Playwright exit code 1 ·
194
+ details: performance failed (code 2) in …/outcome.json`.
195
+ - The thresholds diff lists the skipped keys with the reason (`no successful samples, 5 needed
196
+ (5 × 404)`): up to 5 in the console, all in `thresholds-diff.md`. The Apdex T limit reads
197
+ `apdex T 500 ms` instead of `t 500`.
198
+ - Samples from a project that is only a dependency or teardown of other projects (a usual `setup`
199
+ project) no longer give the `STATS_SAMPLES_OUTSIDE_MEASURED_PROJECTS` warning.
200
+ - `TESTS_NOT_INSTRUMENTED` counts tests instead of test results and names up to three files, e.g.
201
+ `2 tests in tests/api.spec.ts import test without withPerfFixtures() …`; a crashed worker is
202
+ mentioned only when a worker actually crashed.
203
+ - The examples run with `PW_PERF_MODE=… npm test` instead of `perf:*` scripts.
204
+
205
+ ### Fixed
206
+
207
+ - Collector: with Playwright 1.57 (Chromium) a `fetch` answered with `204 No Content` was
208
+ recorded as `ABORTED` with no time, so endpoints such as `DELETE /api/items/:id` were never
209
+ measured. A 204, 205 or 304 response followed by `requestfailed` is now a sample with its status
210
+ and time.
211
+ - Collector: a request whose response arrived but whose body was then aborted (typically a login
212
+ or form `fetch` followed at once by `location.href = …`) was recorded as `ABORTED`, so
213
+ successful logins were never measured and the key kept only the failed attempts. A response
214
+ followed by an abort (`net::ERR_ABORTED`, `NS_BINDING_ABORTED`, …) is now a sample with its
215
+ status and time (up to the end of the body, or to the headers when the body was cut off); other
216
+ failures after a response stay `FAILED`.
217
+ - Types of `playwright-performance-regression/config`, `/fixture`, `/test` and `/reporter`
218
+ resolve in TypeScript projects without `exports` support (`"module": "commonjs"` with no
219
+ `moduleResolution`, i.e. `node10`): `tsc` no longer fails with `Cannot find module`, and a
220
+ wrapped `test` keeps its fixture types instead of `any`.
221
+ - With `PW_PERF_PASSES` above 1, `PW_PERF_MODE=… npx playwright test` no longer starts pass 2 as
222
+ `npm run npx` ("Missing script"): a package script runs again only when `package.json` has it.
223
+ The `Next:` hint no longer suggests `npm run npx` either.
224
+ - `CONFIG_SLOW_MO` warns only about projects measured in the run. A run with `--project=api`
225
+ warned about the `slowMo` of an e2e project that did not run (and of setup projects), in every
226
+ run.
227
+ - A thresholds run that selects a subset of the tests (`--grep`, `--project`, file filters) no
228
+ longer ends with "Run with PW_PERF_PRUNE=1 to remove them": pruning is ignored in such a run
229
+ (`RUN_PRUNE_SKIPPED`). The line now says that the run selects a subset of the tests.
230
+ - A `PW_PERF_MODE=thresholds` run no longer warns with `THRESHOLDS_FILE_MISSING` about the
231
+ thresholds file it is creating.
232
+ - `PW_PERF_MODE=check` uses the singular for one item (`1 sample · 1 test`, `5 requests in 1
233
+ test`, `1 of 1 test run`, `1 api key`) instead of `1 samples · 1 tests`.
234
+ - HTML report: long endpoint and step names no longer run into the next column. In the Endpoints
235
+ and Steps tables the name wraps inside the Key cell; in the Overview cards it is cut with an
236
+ ellipsis and the full name is shown on hover.
237
+ - HTML report: the key labels of a waterfall (Tests tab) are monospace with the method in its
238
+ colour again; in Chromium they were unstyled and a long method such as `DELETE` overlapped the
239
+ path.
240
+ - Setup wizard: project detection reads the whole project, not only `testDir`, so fixtures modules
241
+ and page objects next to the test directory (e.g. `testDir: './tests/specs'` with
242
+ `tests/fixtures/`) are found: a single fixtures module there is wrapped, and the "nothing is
243
+ measured yet" box lists the files with `.extend(`. `.extend(` in application code (e.g. zod
244
+ schemas) no longer counts as a fixtures module, and the box counts only test files that import
245
+ `test` from `@playwright/test`, not page objects or fixtures modules.
246
+ - Setup wizard: the red box no longer says "nothing is measured yet" when you answer `all` and your
247
+ tests use `test.step`: the step durations are measured, so the box says "Endpoints are not
248
+ measured yet" (in all 7 languages), and the wizard offers the check.
249
+ - Setup wizard: the red box (`INIT_TEST_OBJECT_MANUAL`) is full width in a pseudo-terminal that
250
+ reports 0 columns (e.g. `expect`, `docker -t`) instead of being cut to 40 columns, and counts
251
+ the test files as `(files: 1)` instead of `(1 files)` (English, Spanish, French, Italian).
252
+ - Setup wizard: no `.gitignore` entry is added when the file already ignores the report folder
253
+ with a glob such as `/reports/**/*` or `reports/*`.
254
+ - Setup wizard translations reviewed: the no-terminal note has its missing full stop in every
255
+ language; one term per idea in each language (es "tests", it "passaggi" and "verifica", uk/ru
256
+ "воркер" and endpoint keys); French uses a no-break space before `:` `;` `?` `!` and French and
257
+ Italian use typographic apostrophes; the red box title fits 80 columns in every language (it
258
+ was cut in es, fr, pl and it).
259
+
260
+ ## [0.1.0-next.3] - 2026-11-21
261
+
262
+ `0.1.0-next.2` was tagged but not published (the release stopped on the performance tests).
263
+
264
+ ### Added
265
+
266
+ - `thresholds.preset`: `strict`, `normal` (default, the previous margins) or `loose` sets the
267
+ headroom of every derived threshold; fields in `checks.*.margin` still win.
268
+ - `run.grep`: only tests whose title or tags match run in perf mode (e.g. `'@perf'`), applied to
269
+ the measured projects only, so setup projects run in full.
270
+ - `pw-perf.config.ts` written by `init` starts with a "Most important settings" block.
271
+
272
+ - Passes: a run now runs your test command several times in a row (`run.passes`: 5 for `test`,
273
+ 10 for `thresholds`; `PW_PERF_PASSES` or `--passes` for one run) instead of repeating each test
274
+ inside one Playwright run. Setup steps of the script (seeding data) run before every pass. Each
275
+ pass writes `pw-perf-results/pass-<k>.json` and the first pass evaluates all of them together:
276
+ one report (with `passes` in `report.json` and a "Passes" tile) and one result. A pass without
277
+ data gives `RUN_PASS_FAILED`; an interrupted pass `RUN_PASS_INTERRUPTED`. See `docs/cli.md`.
278
+ - A start banner with the mode, projects, tests × passes, a time estimate and the report path; in
279
+ a terminal outside CI it asks `Continue? (Y/n)` (`PW_PERF_YES=1` skips it).
280
+
281
+ - `check`: a dry run before the first measurement (`PW_PERF_MODE=check npm run e2e`, or
282
+ `npx pw-perf check`). It runs the first test of each file once (at most `--max-tests`,
283
+ `PW_PERF_MAX_TESTS`, default 10) and shows the projects, origins with their labels, top keys,
284
+ the thresholds files and an estimate of the full runs; it evaluates nothing and writes no files.
285
+ `CHECK_RANDOM_HOST` proposes host patterns for generated CI hosts.
286
+
287
+ - Host patterns in `keys.origins`: `'https://*.ci.example.com': ''` labels random hosts of CI
288
+ instances; `*` matches inside one host label, an exact entry wins, more literal characters win
289
+ between patterns. `baseURL` origins covered by `keys.origins` no longer change the
290
+ normalization fingerprint, so random `baseURL` hosts stop giving `THRESHOLDS_SOURCE_MISMATCH`.
291
+ Thresholds files derived before with an exact entry for the `baseURL` origin give
292
+ `THRESHOLDS_SOURCE_MISMATCH` once. See `docs/dynamic-environments.md`.
293
+
294
+ - After every run the last line is a `Next:` hint with the exact command of your project: derive
295
+ thresholds (`PW_PERF_MODE=thresholds npm run e2e`), commit the written files, or run the check
296
+ when nothing was measured. The command follows how the run was started (npm, pnpm or yarn
297
+ script, plain `npx playwright test`, or `npx pw-perf`).
298
+ - Warnings `RUN_PROJECT_NO_REQUESTS` (a measured project with only API tests) and
299
+ `CONFIG_BASEURL_EMPTY` (an empty `use.baseURL` or one built from an unset variable).
300
+
301
+ - Environment mode as the recommended way to run: `PW_PERF_MODE=test npm run e2e` (or `thresholds`)
302
+ runs your own test command in perf mode. The reporter writes the exact result to
303
+ `pw-perf-results/outcome.json` (exit code 0, 2 or 3; the old file is removed when the run starts)
304
+ and prints an `Outcome:` line; Playwright keeps its own exit code. `withPerf()` gives the workers
305
+ the run id and warns about `--reporter` (`RUN_REPORTER_FLAG`) and `--ui`/`--debug`
306
+ (`RUN_UNSUPPORTED_FLAG`); `PW_PERF_PRUNE=1` with a test filter writes the files without pruning
307
+ (`RUN_PRUNE_SKIPPED`). See the new section of `docs/cli.md`.
308
+
309
+ - Step timings: with `measure: { steps: true }` the durations of the existing `test.step` blocks
310
+ become keys of kind `step` (for example `login › submit`), checked and derived like endpoints,
311
+ with their own thresholds file `pw-perf-thresholds.steps.json`, a `Steps:` line in the console
312
+ and a Steps tab in the HTML report. Step titles are sanitized: ids, e-mails, URLs and secrets
313
+ never reach the keys or the reports, also inside quotes. Options `categories`, `maxDepth`,
314
+ `include`, `exclude`, `groupBy`, `normalizeTitles` and `redactQuotedValues`; warnings
315
+ `STEPS_NONE_FOUND`, `STEPS_HIGH_CARDINALITY`, `STEPS_TOO_MANY_KEYS` and
316
+ `STEPS_SECRET_REDACTED`. `init` asks about it when the project has `test.step` calls. See
317
+ `docs/steps.md`.
318
+
319
+ - The run report (`report.json`) holds more data for the HTML report: a
320
+ histogram of the retained durations per key, the median time outside TTFB
321
+ (`ttfb.otherP50`), the part of each limit a check uses (`usage`), up to three rule-based hints
322
+ per key, and `testBreakdown`: the backend cost of the 500 most expensive tests and a request
323
+ waterfall of the 5 slowest test runs.
324
+
325
+ ### Changed
326
+
327
+ - The HTML report has a new look: an app bar with the run details, a verdict card with the three
328
+ results (performance, tests, tool errors) and the exit code, a KPI strip, sticky tabs, violation
329
+ cards with the first hint, rankings with bars and an Endpoints/Steps switch, endpoints shown with
330
+ a colored method badge and highlighted path parameters, and failures in a clear red (light and
331
+ dark theme). Key details open in a centered dialog (`Esc`, Close or a click outside closes it;
332
+ full screen on phones). The details show p50, the evaluated percentile, p99 and max at a glance, the histogram bars above the limit in red and a headroom
333
+ meter for every check. Times in the key tables are whole milliseconds without a unit (the table
334
+ footer says “All times in ms”). Error rates in the checks are shown as percentages.
335
+ - The run summary and the `check` output are easier to scan: errors, warnings and the verdict
336
+ are in framed boxes, the counters and the violations in tables with lines, and statuses carry
337
+ emoji (✅ ⚠ ❌). Long warning messages wrap inside the box. `NO_COLOR` turns off only the
338
+ colors; `TERM=dumb` also turns frames into ASCII and emoji into `✔ ! ✖`.
339
+ - The `TESTS_FAILED` warning now says that the samples of failed tests are counted.
340
+ - `pw-perf init` is rebuilt around your own test command: it detects the scripts that run
341
+ `playwright test` and shows `Run: PW_PERF_MODE=test npm run <script>`, warns about flags that
342
+ break a measurement run (`INIT_SCRIPT_FLAG`) and later steps of the script
343
+ (`INIT_SCRIPT_LATER_STEPS`), asks which projects to measure, writes `@perf` as `run.grep`,
344
+ asks for the headroom preset, no longer asks about a trial period or environments, and ends
345
+ with a check. Steps 1 and 2 are one step with a short description of the package.
346
+ - When the wizard cannot wrap your fixtures module it changes no test file and shows a red box
347
+ with the code to paste (`INIT_TEST_OBJECT_MANUAL`). Without `playwright.config` it stops before
348
+ the first question.
349
+ - The CI recipes in `examples/ci/` (and the files `init` writes) have two jobs: a thresholds job
350
+ you start by hand that keeps the thresholds files as an artifact, and a weekly measurement job;
351
+ both set `PW_PERF_MODE` and run your test command, and read the exit code from
352
+ `pw-perf-results/outcome.json`.
353
+ - `npx pw-perf` without arguments prints the help instead of an error, with a box pointing to
354
+ `npx pw-perf init` in a project without config.
355
+
356
+ - **Breaking:** `run.repeat`, `PW_PERF_REPEAT` and `--repeat` are renamed to `run.passes`,
357
+ `PW_PERF_PASSES` and `--passes`; the old names are errors with a hint. Every project runs with
358
+ `repeatEach: 1`.
359
+ - Perf mode no longer forces `retries: 0`: the retries of your Playwright config apply, every
360
+ attempt is measured and a test that passes on a retry counts as passed. Retries no longer give
361
+ `RUN_CONDITIONS_CHANGED`.
362
+ - `pw-perf test` and `thresholds` print no mode line before the run; the start banner replaces it.
363
+ - `npx pw-perf --help` starts with the recommended form (`PW_PERF_MODE=test npm run e2e`, also
364
+ `thresholds` and `check`, with the Windows line) and presents the commands as the advanced
365
+ runner; it lists `--max-tests`. The README quick start uses the same form and says where the
366
+ result is (`pw-perf-results/outcome.json`).
367
+ - The HTML report size limit for 500 keys, 500 tests and 5 waterfalls is 10 MB (was 5 MB).
368
+ - The HTML report is redesigned: a verdict banner and key figures on top, tabs (Overview,
369
+ Endpoints, Tests, Warnings, Run & config), the details of a key with
370
+ links to it (`#key=api:<key>`, `#tab=tests`), search and filter chips, rankings (slowest, most
371
+ called, highest error rate, closest to the limit), a histogram per key, the split of TTFB and
372
+ the rest of the time, hints that explain a violation, the headroom to every limit, the backend
373
+ cost of each test and a waterfall of the 5 slowest test runs. It still is one offline file that
374
+ works without JavaScript, prints and adapts to the dark theme and small screens.
375
+ - `report.json` files written by `0.1.0-next.1` or earlier are migrated when read (`thresholds
376
+ --from`, `report`); the new fields are empty in them.
377
+ - Breaking: new format versions. The sample attachment is version 2 (without `custom`), the
378
+ thresholds file version 2 (`kind` is `api`) and `report.json` version 3 (without `custom` and
379
+ `evaluation.counts.custom`). Thresholds files of version 1 and run reports of versions 1 and 2
380
+ are migrated when read; the package writes the new versions. A thresholds file of kind
381
+ `custom` is rejected with `SCHEMA_VALIDATION_FAILED`.
382
+
383
+ - Breaking: the endpoint thresholds file has no kind in its name: `pw-perf-thresholds.json`
384
+ (`pw-perf-thresholds.<env>.json` with an environment label), was `pw-perf-thresholds.api.json`.
385
+ Rename the file with `git mv pw-perf-thresholds.api.json pw-perf-thresholds.json`; the old name
386
+ is not read. The environment labels `steps` and `requests` are reserved.
387
+ - Breaking: every file and directory the package creates now starts with `pw-perf`. The default
388
+ thresholds files are `pw-perf-thresholds.<kind>[.<env>].json` (`thresholds.filePrefix`, was
389
+ `perf-thresholds`) and the default output directory is `pw-perf-results/` (`report.dir`, was
390
+ `perf-results`); the files inside keep their names. The samples attachment of each test is
391
+ `pw-perf-samples` (was `playwright-performance-regression-samples`). Old names are not read: rename existing
392
+ thresholds files and the `.gitignore` entry, or set the old values in the config.
393
+ - `init` no longer asks for the label of the `baseURL` origin: labels are automatic (no label for
394
+ the `baseURL` origin, the host for other hosts), and the summary points to `keys.origins` for
395
+ shorter labels. The steps are numbered 1 to 10.
396
+ - `init` measures all tests by default, also when some tests are tagged `@perf` and with `--yes`.
397
+ `INIT_NO_TAGGED_TESTS` is now information shown in the wizard, not a warning.
398
+ - The `pw-perf.config.ts` written by `init` lists every option: the answers that differ from the
399
+ defaults as code, all other options as comments with their default value and a one-line
400
+ description, grouped by section. The comments are generated from the config schema.
401
+ - Measurement runs replace the `list` reporter with `dot` and add `dot` (also locally) when no
402
+ console reporter is left, so hundreds of executions no longer flood the terminal. Keep `list`
403
+ with `--reporter=list` or `run.keepReporters: ['list']`. The info line at the start says
404
+ `reporter list replaced with dot`.
405
+ - The run summary is easier to spot and read: a separator line and a bold header, bold section
406
+ headings, red error codes, yellow warning codes, dim hints, red blocking and yellow
407
+ non-blocking rows, and the verdict as a colored badge (`✔ PASSED`, `! PASSED WITH WARNINGS`,
408
+ `✖ FAILED`, `✖ ERROR`). Without colors the text keeps the same words and markers.
409
+ - The summary ends with one `Report:` line with the absolute path of `report.html` (or
410
+ `report.json` without HTML), and the thresholds diff with an absolute `Diff:` path; the CLI no
411
+ longer prints the `report:` and `thresholds diff:` lines after them.
412
+ - The counters line omits zero counts and says what it counts, e.g. `19 keys · 19 from file ·
413
+ 8 checked by median only (few samples) · 2 file entries not seen`.
414
+ - `THRESHOLDS_FILE_MISSING` is reported only for a kind that has keys in the run.
415
+
416
+ ### Removed
417
+
418
+ - **Breaking:** `gate.warnOnly` (the trial mode). The option is now `CONFIG_UNKNOWN_OPTION` with a
419
+ hint; to keep a CI job green on a regression, set `continue-on-error` on the job, or use
420
+ `gate.tolerance` / `gate.defaultThresholds: 'warn'`.
421
+ - **Breaking:** `pw-perf init` no longer writes `perf:*` scripts to `package.json` and no longer
422
+ changes test files (no import swap). Scripts written by an earlier wizard keep working.
423
+ - Breaking: custom measurements. `perf.measure()`, `perf.start()`, `perf.end()`,
424
+ `perf.sampleStart()` and `perf.sampleEnd()` are removed; the `perf` fixture keeps only
425
+ `perf.track(context)`, so old calls no longer type-check and throw a `TypeError` in JavaScript.
426
+ The kind `custom` is gone with its thresholds file `pw-perf-thresholds.custom[.<env>].json`
427
+ (no longer read or written; delete it by hand), the options `checks.*.*.limit.custom`,
428
+ `checks.errors.limit.custom` and `checks.slowShare.t.custom` (now `CONFIG_UNKNOWN_OPTION` with
429
+ a hint), the `CUSTOM_*` warnings, the `Custom:` line of the summary, the Custom tab of the HTML
430
+ report and the migration notes for `playwright-performance`. Time user-visible steps with
431
+ `test.step()` and `measure.steps: true` instead. See
432
+ [Upgrading](docs/upgrading.md#from-010-next1-to-010-next3-custom-measurements-removed).
433
+
434
+ ### Fixed
435
+
436
+ - A run with too many failed tests (`TESTS_FAILED_TOO_MANY`) or another run problem no longer
437
+ reports "1 tool error" and "performance failed": the verdict names the cause (`too many failed
438
+ tests (30 of 101 executions); the performance result is not trustworthy`) and the CLI says
439
+ `performance result not trustworthy`. The exit code stays 3.
440
+
10
441
  ## [0.1.0-next.1] - 2026-11-19
11
442
 
12
443
  ### Added