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

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 (40) hide show
  1. package/CHANGELOG.md +181 -0
  2. package/README.md +70 -51
  3. package/dist/{chunk-GCA73FFP.cjs → chunk-2JO5HVPC.cjs} +351 -44
  4. package/dist/{chunk-WZVQK7CQ.cjs → chunk-44ASXVQN.cjs} +96 -198
  5. package/dist/{chunk-L5C63HEF.js → chunk-AQ2XKYNV.js} +347 -45
  6. package/dist/chunk-BAOTUUTV.cjs +611 -0
  7. package/dist/chunk-DX36GFOZ.js +558 -0
  8. package/dist/chunk-LTRHMBVY.js +5592 -0
  9. package/dist/{chunk-B64P2D5A.js → chunk-MUZFQKGQ.js} +82 -184
  10. package/dist/cli.js +2825 -1406
  11. package/dist/config.cjs +91 -44
  12. package/dist/config.d.cts +4 -2
  13. package/dist/config.d.ts +4 -2
  14. package/dist/config.js +84 -37
  15. package/dist/fixture.cjs +5 -5
  16. package/dist/fixture.d.cts +2 -2
  17. package/dist/fixture.d.ts +2 -2
  18. package/dist/fixture.js +3 -3
  19. package/dist/index.cjs +3 -3
  20. package/dist/index.d.cts +110 -22
  21. package/dist/index.d.ts +110 -22
  22. package/dist/index.js +1 -1
  23. package/dist/perf-api-Rm1h1O_-.d.cts +12 -0
  24. package/dist/perf-api-Rm1h1O_-.d.ts +12 -0
  25. package/dist/reporter.cjs +5184 -1207
  26. package/dist/reporter.js +2029 -245
  27. package/dist/test.cjs +4 -4
  28. package/dist/test.js +3 -3
  29. package/package.json +3 -1
  30. package/schemas/common.schema.json +2 -2
  31. package/schemas/config.schema.json +57 -21
  32. package/schemas/outcome.schema.json +1 -1
  33. package/schemas/run-report.schema.json +534 -19
  34. package/schemas/samples.schema.json +4 -39
  35. package/schemas/thresholds.schema.json +1 -1
  36. package/dist/chunk-3CLCMD2Q.js +0 -3411
  37. package/dist/chunk-4SFI55HF.cjs +0 -319
  38. package/dist/chunk-HBGADXLP.js +0 -254
  39. package/dist/perf-api-V4PeHVE0.d.cts +0 -22
  40. package/dist/perf-api-V4PeHVE0.d.ts +0 -22
package/dist/test.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  'use strict';
2
2
 
3
- var chunkWZVQK7CQ_cjs = require('./chunk-WZVQK7CQ.cjs');
4
- require('./chunk-4SFI55HF.cjs');
5
- require('./chunk-GCA73FFP.cjs');
3
+ var chunk44ASXVQN_cjs = require('./chunk-44ASXVQN.cjs');
4
+ require('./chunk-BAOTUUTV.cjs');
5
+ require('./chunk-2JO5HVPC.cjs');
6
6
  var test$1 = require('@playwright/test');
7
7
 
8
- var test = chunkWZVQK7CQ_cjs.withPerfFixtures(test$1.test);
8
+ var test = chunk44ASXVQN_cjs.withPerfFixtures(test$1.test);
9
9
 
10
10
  Object.defineProperty(exports, "expect", {
11
11
  enumerable: true,
package/dist/test.js CHANGED
@@ -1,7 +1,7 @@
1
- import { withPerfFixtures } from './chunk-B64P2D5A.js';
1
+ import { withPerfFixtures } from './chunk-MUZFQKGQ.js';
2
2
  import './chunk-DYLCGMI2.js';
3
- import './chunk-HBGADXLP.js';
4
- import './chunk-L5C63HEF.js';
3
+ import './chunk-DX36GFOZ.js';
4
+ import './chunk-AQ2XKYNV.js';
5
5
  import { test as test$1 } from '@playwright/test';
6
6
  export { expect } from '@playwright/test';
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playwright-performance-regression",
3
- "version": "0.1.0-next.1",
3
+ "version": "0.1.0-next.3",
4
4
  "description": "Catch backend performance regressions from the Playwright tests you already have.",
5
5
  "keywords": [
6
6
  "playwright",
@@ -114,6 +114,8 @@
114
114
  "check:ci-generated": "node scripts/build-ci-templates.mjs --check",
115
115
  "gen:docs": "node scripts/build-config-docs.mjs",
116
116
  "check:docs-generated": "node scripts/build-config-docs.mjs --check",
117
+ "gen:config-template": "node scripts/build-config-template.mjs",
118
+ "check:config-template-generated": "node scripts/build-config-template.mjs --check",
117
119
  "check:packages": "node scripts/check-packages.mjs",
118
120
  "publint": "publint --strict && publint --strict create",
119
121
  "attw": "attw --pack . --profile node16"
@@ -24,14 +24,14 @@
24
24
  "mode": { "description": "Perf mode of the run: 'test' (measurement run) or 'thresholds' (thresholds derivation run).", "enum": ["test", "thresholds"] },
25
25
  "envLabel": { "description": "Environment label (D-18). Lowercase letters, digits and hyphens.", "type": "string", "pattern": "^[a-z0-9-]+$", "maxLength": 32 },
26
26
  "envLabelOrNull": { "description": "Environment label, or null when not set.", "oneOf": [{ "$ref": "#/$defs/envLabel" }, { "type": "null" }] },
27
- "kind": { "description": "Sample category: 'api' (backend endpoints) or 'custom' (custom measurements).", "enum": ["api", "custom"] },
27
+ "kind": { "description": "Sample category: 'api' (backend endpoints) or 'step' (test.step durations, 06).", "enum": ["api", "step"] },
28
28
  "percentileName": {
29
29
  "description": "Percentile name: 'p' followed by a number greater than 0 and less than 100 with at most one decimal, e.g. p50, p95, p99.9.",
30
30
  "type": "string",
31
31
  "pattern": "^p(?:[1-9][0-9]?)(?:\\.[0-9])?$"
32
32
  },
33
33
  "key": {
34
- "description": "Aggregate key: normalized endpoint key (07) or custom measurement name (06). The package limits keys to 2000 UTF-16 code units (07-REQ-18); maxLength here counts code points, so every key the package writes satisfies it.",
34
+ "description": "Aggregate key: normalized endpoint key (07) or step key (06). The package limits keys to 2000 UTF-16 code units (07-REQ-18); maxLength here counts code points, so every key the package writes satisfies it.",
35
35
  "type": "string",
36
36
  "minLength": 1,
37
37
  "maxLength": 2000
@@ -18,21 +18,21 @@
18
18
  "$ref": "common.schema.json#/$defs/envLabelOrNull",
19
19
  "default": null
20
20
  },
21
- "repeat": {
22
- "description": "Repetitions of each measured test (D-03). Overridden by PW_PERF_REPEAT / --repeat for the current mode.",
21
+ "passes": {
22
+ "description": "Passes of the test command (D-03, D-39): the command runs once per pass and every test runs once in each pass. Overridden by PW_PERF_PASSES / --passes for the current mode.",
23
23
  "type": "object",
24
24
  "additionalProperties": false,
25
25
  "default": {},
26
26
  "properties": {
27
27
  "test": {
28
- "description": "Repetitions in a measurement run.",
28
+ "description": "Passes in a measurement run.",
29
29
  "type": "integer",
30
30
  "minimum": 1,
31
31
  "maximum": 1000,
32
32
  "default": 5
33
33
  },
34
34
  "thresholds": {
35
- "description": "Repetitions in a thresholds derivation run.",
35
+ "description": "Passes in a thresholds derivation run.",
36
36
  "type": "integer",
37
37
  "minimum": 1,
38
38
  "maximum": 1000,
@@ -41,12 +41,17 @@
41
41
  }
42
42
  },
43
43
  "projects": {
44
- "description": "Which Playwright projects are measured and repeated in perf mode (D-04, D-13, D-22; behaviour: 04-REQ-18). 'auto': projects whose effective browser is Chromium (use.browserName, else use.defaultBrowserType from a device descriptor, else chromium; chrome/msedge channels count as Chromium) and which are neither a dependency nor a teardown of another project. A list: exactly these project names; a listed project that is also a dependency of another listed project is measured and repeated too.",
44
+ "description": "Which Playwright projects are measured in perf mode (D-13, D-22, D-39; behaviour: 04-REQ-18). 'auto': projects whose effective browser is Chromium (use.browserName, else use.defaultBrowserType from a device descriptor, else chromium; chrome/msedge channels count as Chromium) and which are neither a dependency nor a teardown of another project. A list: exactly these project names; a listed project that is also a dependency of another listed project is measured too.",
45
45
  "oneOf": [{"const": "auto"}, {"type": "array", "items": {"type": "string"}, "minItems": 1, "uniqueItems": true}],
46
46
  "default": "auto"
47
47
  },
48
+ "grep": {
49
+ "description": "Only tests whose title or tags match this regular expression run in perf mode, e.g. '@perf' (03-REQ-25). Applied case-insensitively to the measured projects only; their setup and teardown projects run in full. null: all tests.",
50
+ "oneOf": [{"type": "null"}, {"type": "string", "minLength": 1}],
51
+ "default": null
52
+ },
48
53
  "keepReporters": {
49
- "description": "Reporters kept in perf mode by name, as in the Playwright reporter config (e.g. 'junit', 'allure-playwright'). By default withPerf() keeps only the console reporters (list, line, dot, github) and the package reporter (D-23, 04-REQ-32).",
54
+ "description": "Reporters kept in perf mode by name, as in the Playwright reporter config (e.g. 'junit', 'allure-playwright'). By default withPerf() keeps only the console reporters line, dot and github (list becomes dot; name list here to keep it) and the package reporter (D-23, 04-REQ-32).",
50
55
  "type": "array",
51
56
  "uniqueItems": true,
52
57
  "items": {"type": "string", "minLength": 1},
@@ -134,7 +139,34 @@
134
139
  "items": {"type": "string", "pattern": "^(?:[1-5]xx|[1-5][0-9]{2})$"},
135
140
  "default": ["2xx", "3xx"]
136
141
  },
137
- "pendingTimeoutMs": {
142
+ "steps": {
143
+ "description": "Durations of test.step steps as keys of kind 'step' (06). false (default) disables, true enables with defaults, an object enables with settings (03-REQ-18).",
144
+ "default": false,
145
+ "oneOf": [
146
+ {"type": "boolean"},
147
+ {
148
+ "type": "object",
149
+ "additionalProperties": false,
150
+ "properties": {
151
+ "enabled": {"description": "Default true when an object is given.", "type": "boolean"},
152
+ "include": {"description": "When not empty, only steps whose step key part matches at least one pattern give samples (06-REQ-22).", "type": "array", "items": {"$ref": "#/$defs/urlPattern"}},
153
+ "exclude": {"description": "Steps whose step key part matches any pattern give no samples; exclude wins over include.", "type": "array", "items": {"$ref": "#/$defs/urlPattern"}},
154
+ "maxDepth": {"description": "Deepest step level measured; deeper steps are included in their ancestor's time (06-REQ-21).", "type": "integer", "minimum": 1, "maximum": 10},
155
+ "categories": {
156
+ "description": "Playwright step categories measured (06-REQ-20). Steps of other categories are transparent for keys and depth.",
157
+ "type": "array",
158
+ "minItems": 1,
159
+ "uniqueItems": true,
160
+ "items": {"enum": ["test.step", "expect", "pw:api", "fixture", "hook"]}
161
+ },
162
+ "groupBy": {"description": "'step': one key per step path across tests; 'test': one key per test and step path (06-REQ-23).", "enum": ["step", "test"]},
163
+ "normalizeTitles": {"description": "false skips the key-stability rules (ids, dates, numbers); privacy rules always apply (06-REQ-35).", "type": "boolean"},
164
+ "redactQuotedValues": {"description": "true replaces quoted values in step titles with :value; by default they stay in keys (06-D-26).", "type": "boolean"}
165
+ }
166
+ }
167
+ ]
168
+ },
169
+ "pendingTimeoutMs": {
138
170
  "description": "How long the collector waits at test end for requests still in flight (05).",
139
171
  "type": "integer",
140
172
  "minimum": 0,
@@ -150,9 +182,9 @@
150
182
  "default": {},
151
183
  "properties": {
152
184
  "origins": {
153
- "description": "Origin to label mapping, e.g. {\"https://api.example.com\": \"api\"}. The origin of Playwright use.baseURL gets the empty label unless mapped here. Other origins are labeled with their host.",
185
+ "description": "Origin to label mapping, e.g. {\"https://api.example.com\": \"api\"}. A key with * is a host pattern, e.g. \"https://*.ci.example.com\" (one * per host label, never across a dot); an exact entry wins over a pattern. The origin of Playwright use.baseURL gets the empty label unless mapped here. Other origins are labeled with their host.",
154
186
  "type": "object",
155
- "propertyNames": {"pattern": "^https?://[^/?#]+$"},
187
+ "propertyNames": {"pattern": "^(?:https?://[^/?#]+|.*\\*.*)$"},
156
188
  "additionalProperties": {"type": "string", "pattern": "^[a-z0-9.-]*$", "maxLength": 64},
157
189
  "default": {}
158
190
  },
@@ -264,7 +296,7 @@
264
296
  "default": {},
265
297
  "properties": {
266
298
  "api": {"$ref": "common.schema.json#/$defs/msLimit", "default": 2000},
267
- "custom": {"$ref": "common.schema.json#/$defs/msLimit", "default": 5000}
299
+ "step": {"$ref": "common.schema.json#/$defs/msLimit", "default": 10000}
268
300
  }
269
301
  }
270
302
  }
@@ -294,7 +326,7 @@
294
326
  "default": {},
295
327
  "properties": {
296
328
  "api": {"$ref": "common.schema.json#/$defs/msLimit", "default": 2000},
297
- "custom": {"$ref": "common.schema.json#/$defs/msLimit", "default": 5000}
329
+ "step": {"$ref": "common.schema.json#/$defs/msLimit", "default": 15000}
298
330
  }
299
331
  },
300
332
  "margin": {
@@ -370,7 +402,7 @@
370
402
  "default": {},
371
403
  "properties": {
372
404
  "api": {"$ref": "common.schema.json#/$defs/msLimit", "default": 4000},
373
- "custom": {"$ref": "common.schema.json#/$defs/msLimit", "default": 10000}
405
+ "step": {"$ref": "common.schema.json#/$defs/msLimit", "default": 30000}
374
406
  }
375
407
  }
376
408
  }
@@ -407,7 +439,7 @@
407
439
  },
408
440
  "default": {"min": 500, "max": 2000, "medianFactor": 2}
409
441
  },
410
- "custom": {
442
+ "step": {
411
443
  "type": "object",
412
444
  "additionalProperties": false,
413
445
  "properties": {
@@ -469,7 +501,7 @@
469
501
  "default": {},
470
502
  "properties": {
471
503
  "api": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.85},
472
- "custom": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.85}
504
+ "step": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.85}
473
505
  }
474
506
  }
475
507
  }
@@ -537,7 +569,7 @@
537
569
  "default": {},
538
570
  "properties": {
539
571
  "api": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.05},
540
- "custom": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.05}
572
+ "step": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.05}
541
573
  }
542
574
  }
543
575
  }
@@ -558,7 +590,7 @@
558
590
  "default": 5
559
591
  },
560
592
  "statuses": {
561
- "description": "Request statuses counted as errors by the 'errors' rule (08, 09): a class like '5xx', an exact code like '429', FAILED (request failed without a response, not aborted), ABORTED (cancelled by the browser, e.g. on navigation), PENDING (still in flight at test end). Custom measurements: outcomes error and unfinished are always errors.",
593
+ "description": "Request statuses counted as errors by the 'errors' rule (08, 09): a class like '5xx', an exact code like '429', FAILED (request failed without a response, not aborted), ABORTED (cancelled by the browser, e.g. on navigation), PENDING (still in flight at test end).",
562
594
  "type": "array",
563
595
  "uniqueItems": true,
564
596
  "items": {"type": "string", "pattern": "^(?:[1-5]xx|[1-5][0-9]{2}|FAILED|ABORTED|PENDING)$"},
@@ -571,7 +603,7 @@
571
603
  "default": {},
572
604
  "properties": {
573
605
  "api": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.05},
574
- "custom": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.05}
606
+ "step": {"$ref": "common.schema.json#/$defs/ratio", "default": 0.05}
575
607
  }
576
608
  },
577
609
  "margin": {
@@ -622,7 +654,6 @@
622
654
  "enum": ["block", "warn"],
623
655
  "default": "block"
624
656
  },
625
- "warnOnly": {"description": "Report violations but never fail the run.", "type": "boolean", "default": false},
626
657
  "maxFailedTestShare": {
627
658
  "description": "Highest share of failed test executions (unexpected / executed, skipped excluded) for which the run result is still trustworthy. Above it the run ends with tool error TESTS_FAILED_TOO_MANY (exit code 3, 09). Failed tests below it are a warning only: in perf mode the performance result decides (00, chapter 11).",
628
659
  "type": "number",
@@ -638,6 +669,11 @@
638
669
  "additionalProperties": false,
639
670
  "default": {},
640
671
  "properties": {
672
+ "preset": {
673
+ "description": "Headroom preset for derived thresholds (D-41, 10-REQ-23): sets the defaults of every checks.*.margin; margin fields set explicitly win. strict: small headroom, catches smaller regressions, more false alarms on a noisy environment. normal: recommended start. loose: large headroom, only clear regressions, for shared noisy environments.",
674
+ "enum": ["strict", "normal", "loose"],
675
+ "default": "normal"
676
+ },
641
677
  "dir": {
642
678
  "description": "Directory of thresholds files, relative to the Playwright config directory.",
643
679
  "type": "string",
@@ -645,10 +681,10 @@
645
681
  "default": "."
646
682
  },
647
683
  "filePrefix": {
648
- "description": "File name prefix; files are <prefix>.<kind>[.<env>].json.",
684
+ "description": "File name prefix; files are <prefix>[.steps][.<env>].json.",
649
685
  "type": "string",
650
686
  "pattern": "^[A-Za-z0-9._-]+$",
651
- "default": "perf-thresholds"
687
+ "default": "pw-perf-thresholds"
652
688
  },
653
689
  "update": {
654
690
  "description": "'all': recompute every unlocked complete entry (with hysteresis, 10); 'new-only': add entries for new keys, keep existing ones.",
@@ -702,7 +738,7 @@
702
738
  "description": "Directory of report.json and report.html, relative to the Playwright config directory.",
703
739
  "type": "string",
704
740
  "minLength": 1,
705
- "default": "perf-results"
741
+ "default": "pw-perf-results"
706
742
  },
707
743
  "html": {"description": "Write the HTML report.", "type": "boolean", "default": true},
708
744
  "rawUrls": {
@@ -9,7 +9,7 @@
9
9
  "properties": {
10
10
  "schemaVersion": { "const": 1 },
11
11
  "runId": { "$ref": "common.schema.json#/$defs/runId" },
12
- "mode": { "$ref": "common.schema.json#/$defs/mode" },
12
+ "mode": { "description": "Perf mode of the run: test, thresholds or check (02-REQ-34). The run report and thresholds files never have check.", "enum": ["test", "thresholds", "check"] },
13
13
  "exitCode": {
14
14
  "description": "Exit code the CLI must use, computed by buildOutcome() in core (00, chapter 11; 02-REQ-26): 0 ok, 2 performance violations block the run, 3 tool error or untrustworthy result. Precedence 3 > 2 > 0. Failed tests alone never give a non-zero code in perf mode (gate.maxFailedTestShare, 09-REQ-24); code 1 is reserved and never written. An interrupted or timed-out run without a signal has RUN_INCOMPLETE in toolErrors, so 3; the CLI itself uses 130/143 after a signal it received, regardless of this file (04).",
15
15
  "enum": [0, 2, 3]