playwright-performance-regression 0.0.0-stage → 0.1.0-next.0
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/CHANGELOG.md +268 -0
- package/LICENSE +21 -0
- package/README.md +214 -2
- package/dist/chunk-6AB42SPF.js +254 -0
- package/dist/chunk-DYLCGMI2.js +63 -0
- package/dist/chunk-GCA73FFP.cjs +1139 -0
- package/dist/chunk-HES6BVZT.js +1097 -0
- package/dist/chunk-JEHUFIY3.js +3390 -0
- package/dist/chunk-LV3O2BAT.cjs +319 -0
- package/dist/chunk-R2NPYGB7.cjs +758 -0
- package/dist/chunk-UTTU4FUC.js +756 -0
- package/dist/cli.js +2909 -0
- package/dist/config.cjs +256 -0
- package/dist/config.d.cts +15 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.js +252 -0
- package/dist/fixture.cjs +16 -0
- package/dist/fixture.d.cts +22 -0
- package/dist/fixture.d.ts +22 -0
- package/dist/fixture.js +4 -0
- package/dist/index.cjs +14 -0
- package/dist/index.d.cts +637 -0
- package/dist/index.d.ts +637 -0
- package/dist/index.js +1 -0
- package/dist/perf-api-V4PeHVE0.d.cts +22 -0
- package/dist/perf-api-V4PeHVE0.d.ts +22 -0
- package/dist/reporter.cjs +4769 -0
- package/dist/reporter.d.cts +18 -0
- package/dist/reporter.d.ts +18 -0
- package/dist/reporter.js +1409 -0
- package/dist/test.cjs +14 -0
- package/dist/test.d.cts +7 -0
- package/dist/test.d.ts +7 -0
- package/dist/test.js +10 -0
- package/package.json +146 -4
- package/schemas/common.schema.json +81 -0
- package/schemas/config.schema.json +875 -0
- package/schemas/outcome.schema.json +44 -0
- package/schemas/run-report.schema.json +505 -0
- package/schemas/samples.schema.json +169 -0
- package/schemas/thresholds.schema.json +138 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,637 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSON form of the package config: a 'pw-perf.config.json' file and the effective config snapshot in the run report. The 'default' keywords are the single source of default values (03-REQ-05). The TypeScript input type additionally accepts RegExp in url patterns and a keyBuilder function (03, chapter 5).
|
|
3
|
+
*/
|
|
4
|
+
interface PackageConfig {
|
|
5
|
+
/**
|
|
6
|
+
* Optional, for editor support in JSON config files.
|
|
7
|
+
*/
|
|
8
|
+
$schema?: string;
|
|
9
|
+
/**
|
|
10
|
+
* How the measurement run is executed (01, 04).
|
|
11
|
+
*/
|
|
12
|
+
run?: {
|
|
13
|
+
/**
|
|
14
|
+
* Environment label (D-18). Overridden by PW_PERF_ENV / --env. Null: no label, one set of thresholds files.
|
|
15
|
+
*/
|
|
16
|
+
env?: string | null;
|
|
17
|
+
/**
|
|
18
|
+
* Repetitions of each measured test (D-03). Overridden by PW_PERF_REPEAT / --repeat for the current mode.
|
|
19
|
+
*/
|
|
20
|
+
repeat?: {
|
|
21
|
+
/**
|
|
22
|
+
* Repetitions in a measurement run.
|
|
23
|
+
*/
|
|
24
|
+
test?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Repetitions in a thresholds derivation run.
|
|
27
|
+
*/
|
|
28
|
+
thresholds?: number;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* 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.
|
|
32
|
+
*/
|
|
33
|
+
projects?: 'auto' | [string, ...string[]];
|
|
34
|
+
/**
|
|
35
|
+
* 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).
|
|
36
|
+
*/
|
|
37
|
+
keepReporters?: string[];
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* What the collector measures (05).
|
|
41
|
+
*/
|
|
42
|
+
measure?: {
|
|
43
|
+
/**
|
|
44
|
+
* Playwright resource types that are measured. WebSocket traffic is not available as Request events in Playwright and cannot be measured (05).
|
|
45
|
+
*
|
|
46
|
+
* @minItems 1
|
|
47
|
+
*/
|
|
48
|
+
resourceTypes?: [
|
|
49
|
+
('document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'eventsource' | 'manifest' | 'other'),
|
|
50
|
+
...('document' | 'stylesheet' | 'image' | 'media' | 'font' | 'script' | 'texttrack' | 'xhr' | 'fetch' | 'eventsource' | 'manifest' | 'other')[]
|
|
51
|
+
];
|
|
52
|
+
/**
|
|
53
|
+
* Requests whose URL path ends with one of these extensions are skipped, except resource type 'document' (05).
|
|
54
|
+
*/
|
|
55
|
+
ignoreExtensions?: string[];
|
|
56
|
+
/**
|
|
57
|
+
* When not empty, only requests whose URL matches at least one pattern are measured.
|
|
58
|
+
*
|
|
59
|
+
* Items: A string matches as a case-sensitive substring of the full URL; {regex, flags} is a JavaScript regular expression.
|
|
60
|
+
*/
|
|
61
|
+
include?: (string | {
|
|
62
|
+
regex: string;
|
|
63
|
+
flags?: string;
|
|
64
|
+
})[];
|
|
65
|
+
/**
|
|
66
|
+
* Requests whose URL matches any pattern are skipped. Applied after include.
|
|
67
|
+
*
|
|
68
|
+
* Items: A string matches as a case-sensitive substring of the full URL; {regex, flags} is a JavaScript regular expression.
|
|
69
|
+
*/
|
|
70
|
+
exclude?: (string | {
|
|
71
|
+
regex: string;
|
|
72
|
+
flags?: string;
|
|
73
|
+
})[];
|
|
74
|
+
/**
|
|
75
|
+
* Skip requests to the built-in list of analytics, tag manager, monitoring and chat hosts (05).
|
|
76
|
+
*/
|
|
77
|
+
excludeKnownThirdParty?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* HTTP statuses counted as successful samples: a class like '2xx' or an exact code like '404'.
|
|
80
|
+
*
|
|
81
|
+
* @minItems 1
|
|
82
|
+
*/
|
|
83
|
+
successStatuses?: [string, ...string[]];
|
|
84
|
+
/**
|
|
85
|
+
* How long the collector waits at test end for requests still in flight (05).
|
|
86
|
+
*/
|
|
87
|
+
pendingTimeoutMs?: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* How raw URLs become endpoint keys (07).
|
|
91
|
+
*/
|
|
92
|
+
keys?: {
|
|
93
|
+
/**
|
|
94
|
+
* 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.
|
|
95
|
+
*/
|
|
96
|
+
origins?: {
|
|
97
|
+
[k: string]: string;
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* Built-in path segment patterns replaced with ':id' (07).
|
|
101
|
+
*/
|
|
102
|
+
idPatterns?: {
|
|
103
|
+
number?: boolean;
|
|
104
|
+
uuid?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Hex strings of at least 16 characters.
|
|
107
|
+
*/
|
|
108
|
+
hex?: boolean;
|
|
109
|
+
/**
|
|
110
|
+
* Tokens of at least 24 characters containing a digit, without separators or with mixed case (07-REQ-08).
|
|
111
|
+
*/
|
|
112
|
+
token?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Random-looking ids of at least 16 characters with a digit, a lowercase and an uppercase letter, e.g. nanoid (07-REQ-08).
|
|
115
|
+
*/
|
|
116
|
+
mixed?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* E-mail addresses, replaced with ':email' (07-REQ-08).
|
|
119
|
+
*/
|
|
120
|
+
email?: boolean;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Additional path segment patterns replaced with ':id'. A string matches a whole segment literally; a regex is tested against the segment.
|
|
124
|
+
*
|
|
125
|
+
* Items: A string matches as a case-sensitive substring of the full URL; {regex, flags} is a JavaScript regular expression.
|
|
126
|
+
*/
|
|
127
|
+
extraIdPatterns?: (string | {
|
|
128
|
+
regex: string;
|
|
129
|
+
flags?: string;
|
|
130
|
+
})[];
|
|
131
|
+
/**
|
|
132
|
+
* 'names': keep sorted parameter names; 'ignore': drop the query string entirely.
|
|
133
|
+
*/
|
|
134
|
+
query?: 'names' | 'ignore';
|
|
135
|
+
/**
|
|
136
|
+
* Query parameters whose values are kept in the key, e.g. ['type'] gives '?type=open'.
|
|
137
|
+
*/
|
|
138
|
+
keepQueryValues?: string[];
|
|
139
|
+
/**
|
|
140
|
+
* Query parameter names always removed from the key (e.g. cache busters with fixed names).
|
|
141
|
+
*/
|
|
142
|
+
dropQueryParams?: string[];
|
|
143
|
+
/**
|
|
144
|
+
* Snapshot only: "[function]" when a custom keyBuilder function was configured (TypeScript/JavaScript config).
|
|
145
|
+
*/
|
|
146
|
+
keyBuilder?: '[function]';
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* What is checked for every key (09) and how thresholds are derived for it (10). Each rule: enabled, minSamples, limit (for keys without an entry in the thresholds file) and margin (headroom added when deriving thresholds).
|
|
150
|
+
*/
|
|
151
|
+
checks?: {
|
|
152
|
+
/**
|
|
153
|
+
* Response-time rules.
|
|
154
|
+
*/
|
|
155
|
+
time?: {
|
|
156
|
+
/**
|
|
157
|
+
* Median (p50) must not exceed the limit.
|
|
158
|
+
*/
|
|
159
|
+
median?: {
|
|
160
|
+
/**
|
|
161
|
+
* Run this rule.
|
|
162
|
+
*/
|
|
163
|
+
enabled?: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Minimum samples for the rule to run (09-REQ-07).
|
|
166
|
+
*/
|
|
167
|
+
minSamples?: number;
|
|
168
|
+
/**
|
|
169
|
+
* Headroom added to the source run value when deriving this limit (10, chapter 5).
|
|
170
|
+
*/
|
|
171
|
+
margin?: {
|
|
172
|
+
/**
|
|
173
|
+
* Relative headroom, e.g. 0.4 = +40%.
|
|
174
|
+
*/
|
|
175
|
+
relative?: number;
|
|
176
|
+
/**
|
|
177
|
+
* Minimum absolute headroom in ms.
|
|
178
|
+
*/
|
|
179
|
+
minMs?: number;
|
|
180
|
+
/**
|
|
181
|
+
* Relative headroom when the key has fewer than thresholds.smallSampleN samples.
|
|
182
|
+
*/
|
|
183
|
+
smallSampleRelative?: number;
|
|
184
|
+
};
|
|
185
|
+
/**
|
|
186
|
+
* Limit in ms for keys without an entry in the thresholds file (00, 4.5).
|
|
187
|
+
*/
|
|
188
|
+
limit?: {
|
|
189
|
+
/**
|
|
190
|
+
* Threshold limit in whole milliseconds, rounded up (02-REQ-08).
|
|
191
|
+
*/
|
|
192
|
+
api?: number;
|
|
193
|
+
/**
|
|
194
|
+
* Threshold limit in whole milliseconds, rounded up (02-REQ-08).
|
|
195
|
+
*/
|
|
196
|
+
custom?: number;
|
|
197
|
+
};
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* The percentile chosen in level must not exceed the limit.
|
|
201
|
+
*/
|
|
202
|
+
percentile?: {
|
|
203
|
+
/**
|
|
204
|
+
* Run this rule.
|
|
205
|
+
*/
|
|
206
|
+
enabled?: boolean;
|
|
207
|
+
/**
|
|
208
|
+
* Minimum samples for the rule to run (09-REQ-07).
|
|
209
|
+
*/
|
|
210
|
+
minSamples?: number;
|
|
211
|
+
/**
|
|
212
|
+
* Which percentile this rule evaluates, e.g. p95 (the thresholds file records it as evaluatedPercentile).
|
|
213
|
+
*/
|
|
214
|
+
level?: string;
|
|
215
|
+
/**
|
|
216
|
+
* Limit in ms for keys without an entry in the thresholds file.
|
|
217
|
+
*/
|
|
218
|
+
limit?: {
|
|
219
|
+
/**
|
|
220
|
+
* Threshold limit in whole milliseconds, rounded up (02-REQ-08).
|
|
221
|
+
*/
|
|
222
|
+
api?: number;
|
|
223
|
+
/**
|
|
224
|
+
* Threshold limit in whole milliseconds, rounded up (02-REQ-08).
|
|
225
|
+
*/
|
|
226
|
+
custom?: number;
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Headroom added to the source run value when deriving this limit (10, chapter 5).
|
|
230
|
+
*/
|
|
231
|
+
margin?: {
|
|
232
|
+
/**
|
|
233
|
+
* Relative headroom, e.g. 0.4 = +40%.
|
|
234
|
+
*/
|
|
235
|
+
relative?: number;
|
|
236
|
+
/**
|
|
237
|
+
* Minimum absolute headroom in ms.
|
|
238
|
+
*/
|
|
239
|
+
minMs?: number;
|
|
240
|
+
/**
|
|
241
|
+
* Relative headroom when the key has fewer than thresholds.smallSampleN samples.
|
|
242
|
+
*/
|
|
243
|
+
smallSampleRelative?: number;
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
/**
|
|
247
|
+
* p99 must not exceed the limit.
|
|
248
|
+
*/
|
|
249
|
+
p99?: {
|
|
250
|
+
/**
|
|
251
|
+
* Run this rule.
|
|
252
|
+
*/
|
|
253
|
+
enabled?: boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Minimum samples for the rule to run (09-REQ-07).
|
|
256
|
+
*/
|
|
257
|
+
minSamples?: number;
|
|
258
|
+
/**
|
|
259
|
+
* Headroom added to the source run value when deriving this limit (10, chapter 5).
|
|
260
|
+
*/
|
|
261
|
+
margin?: {
|
|
262
|
+
/**
|
|
263
|
+
* Relative headroom over the source p99.
|
|
264
|
+
*/
|
|
265
|
+
relative?: number;
|
|
266
|
+
/**
|
|
267
|
+
* The p99 limit is at least this many ms above the percentile limit.
|
|
268
|
+
*/
|
|
269
|
+
minGapMs?: number;
|
|
270
|
+
/**
|
|
271
|
+
* The p99 limit is at least this share above the percentile limit.
|
|
272
|
+
*/
|
|
273
|
+
minGapRelative?: number;
|
|
274
|
+
};
|
|
275
|
+
/**
|
|
276
|
+
* Limit in ms for keys without an entry in the thresholds file.
|
|
277
|
+
*/
|
|
278
|
+
limit?: {
|
|
279
|
+
/**
|
|
280
|
+
* Threshold limit in whole milliseconds, rounded up (02-REQ-08).
|
|
281
|
+
*/
|
|
282
|
+
api?: number;
|
|
283
|
+
/**
|
|
284
|
+
* Threshold limit in whole milliseconds, rounded up (02-REQ-08).
|
|
285
|
+
*/
|
|
286
|
+
custom?: number;
|
|
287
|
+
};
|
|
288
|
+
};
|
|
289
|
+
};
|
|
290
|
+
/**
|
|
291
|
+
* Rules on the share of slow responses, relative to the Apdex threshold T. Run only for keys with a key-specific T from the thresholds file (09-REQ-07).
|
|
292
|
+
*/
|
|
293
|
+
slowShare?: {
|
|
294
|
+
/**
|
|
295
|
+
* Apdex threshold T: satisfied below T, tolerated up to 4T (08). Used by the apdex and wilson rules, which run only for keys whose thresholds file entry has a key-specific t (09-D-12). These settings bound the derived T (10).
|
|
296
|
+
*/
|
|
297
|
+
t?: {
|
|
298
|
+
api?: {
|
|
299
|
+
/**
|
|
300
|
+
* Lower clamp of derived T.
|
|
301
|
+
*/
|
|
302
|
+
min?: number;
|
|
303
|
+
/**
|
|
304
|
+
* Upper clamp of derived T; when p50 is above it, t, minApdex and maxWilson are null (10-D-13).
|
|
305
|
+
*/
|
|
306
|
+
max?: number;
|
|
307
|
+
/**
|
|
308
|
+
* Derived T is at most medianFactor × p50.
|
|
309
|
+
*/
|
|
310
|
+
medianFactor?: number;
|
|
311
|
+
};
|
|
312
|
+
custom?: {
|
|
313
|
+
/**
|
|
314
|
+
* Lower clamp of derived T.
|
|
315
|
+
*/
|
|
316
|
+
min?: number;
|
|
317
|
+
/**
|
|
318
|
+
* Upper clamp of derived T; when p50 is above it, t, minApdex and maxWilson are null (10-D-13).
|
|
319
|
+
*/
|
|
320
|
+
max?: number;
|
|
321
|
+
/**
|
|
322
|
+
* Derived T is at most medianFactor × p50.
|
|
323
|
+
*/
|
|
324
|
+
medianFactor?: number;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Apdex(T) must not fall below the limit (upper confidence bound compared, ADR-0010). Runs only for keys with a key-specific T from the thresholds file.
|
|
329
|
+
*/
|
|
330
|
+
apdex?: {
|
|
331
|
+
/**
|
|
332
|
+
* Run this rule.
|
|
333
|
+
*/
|
|
334
|
+
enabled?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* Minimum samples for the rule to run (09-REQ-07).
|
|
337
|
+
*/
|
|
338
|
+
minSamples?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Headroom added to the source run value when deriving this limit (10, chapter 5).
|
|
341
|
+
*/
|
|
342
|
+
margin?: {
|
|
343
|
+
/**
|
|
344
|
+
* Subtracted from the source Apdex.
|
|
345
|
+
*/
|
|
346
|
+
absolute?: number;
|
|
347
|
+
/**
|
|
348
|
+
* Subtracted when the key has fewer than thresholds.smallSampleN samples.
|
|
349
|
+
*/
|
|
350
|
+
smallSampleAbsolute?: number;
|
|
351
|
+
};
|
|
352
|
+
/**
|
|
353
|
+
* minApdex for hand-written thresholds file entries that set t but omit minApdex (02-REQ-21). Keys without an entry never run this rule (09-D-12).
|
|
354
|
+
*/
|
|
355
|
+
limit?: {
|
|
356
|
+
/**
|
|
357
|
+
* Value between 0 and 1 inclusive. The thresholds generator writes at most 3 decimal places (02-REQ-08); hand-written values with more decimals are accepted (02-D-11).
|
|
358
|
+
*/
|
|
359
|
+
api?: number;
|
|
360
|
+
/**
|
|
361
|
+
* Value between 0 and 1 inclusive. The thresholds generator writes at most 3 decimal places (02-REQ-08); hand-written values with more decimals are accepted (02-D-11).
|
|
362
|
+
*/
|
|
363
|
+
custom?: number;
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
/**
|
|
367
|
+
* Share of samples slower than T must not exceed the limit (lower Wilson bound compared, ADR-0010). Runs only for keys with a key-specific T.
|
|
368
|
+
*/
|
|
369
|
+
wilson?: {
|
|
370
|
+
/**
|
|
371
|
+
* Run this rule.
|
|
372
|
+
*/
|
|
373
|
+
enabled?: boolean;
|
|
374
|
+
/**
|
|
375
|
+
* Minimum samples for the rule to run (09-REQ-07).
|
|
376
|
+
*/
|
|
377
|
+
minSamples?: number;
|
|
378
|
+
/**
|
|
379
|
+
* Headroom added to the source run value when deriving this limit (10, chapter 5).
|
|
380
|
+
*/
|
|
381
|
+
margin?: {
|
|
382
|
+
/**
|
|
383
|
+
* Multiplier of the source share of slow samples.
|
|
384
|
+
*/
|
|
385
|
+
factor?: number;
|
|
386
|
+
/**
|
|
387
|
+
* Added after multiplying.
|
|
388
|
+
*/
|
|
389
|
+
add?: number;
|
|
390
|
+
/**
|
|
391
|
+
* Lower clamp of the derived limit.
|
|
392
|
+
*/
|
|
393
|
+
min?: number;
|
|
394
|
+
/**
|
|
395
|
+
* Upper clamp of the derived limit (self-consistency may exceed it, 10-REQ-05).
|
|
396
|
+
*/
|
|
397
|
+
max?: number;
|
|
398
|
+
/**
|
|
399
|
+
* Minimum limit when the key has fewer than thresholds.smallSampleN samples.
|
|
400
|
+
*/
|
|
401
|
+
smallSampleMin?: number;
|
|
402
|
+
};
|
|
403
|
+
/**
|
|
404
|
+
* maxWilson for hand-written thresholds file entries that set t but omit maxWilson (02-REQ-21). Keys without an entry never run this rule (09-D-12).
|
|
405
|
+
*/
|
|
406
|
+
limit?: {
|
|
407
|
+
/**
|
|
408
|
+
* Value between 0 and 1 inclusive. The thresholds generator writes at most 3 decimal places (02-REQ-08); hand-written values with more decimals are accepted (02-D-11).
|
|
409
|
+
*/
|
|
410
|
+
api?: number;
|
|
411
|
+
/**
|
|
412
|
+
* Value between 0 and 1 inclusive. The thresholds generator writes at most 3 decimal places (02-REQ-08); hand-written values with more decimals are accepted (02-D-11).
|
|
413
|
+
*/
|
|
414
|
+
custom?: number;
|
|
415
|
+
};
|
|
416
|
+
};
|
|
417
|
+
};
|
|
418
|
+
/**
|
|
419
|
+
* Error rate must not exceed the limit (lower Wilson bound compared, ADR-0010).
|
|
420
|
+
*/
|
|
421
|
+
errors?: {
|
|
422
|
+
/**
|
|
423
|
+
* Run this rule.
|
|
424
|
+
*/
|
|
425
|
+
enabled?: boolean;
|
|
426
|
+
/**
|
|
427
|
+
* Minimum samples for the rule to run (09-REQ-07).
|
|
428
|
+
*/
|
|
429
|
+
minSamples?: number;
|
|
430
|
+
/**
|
|
431
|
+
* 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.
|
|
432
|
+
*/
|
|
433
|
+
statuses?: string[];
|
|
434
|
+
/**
|
|
435
|
+
* Limit for keys without an entry in the thresholds file.
|
|
436
|
+
*/
|
|
437
|
+
limit?: {
|
|
438
|
+
/**
|
|
439
|
+
* Value between 0 and 1 inclusive. The thresholds generator writes at most 3 decimal places (02-REQ-08); hand-written values with more decimals are accepted (02-D-11).
|
|
440
|
+
*/
|
|
441
|
+
api?: number;
|
|
442
|
+
/**
|
|
443
|
+
* Value between 0 and 1 inclusive. The thresholds generator writes at most 3 decimal places (02-REQ-08); hand-written values with more decimals are accepted (02-D-11).
|
|
444
|
+
*/
|
|
445
|
+
custom?: number;
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* Headroom added to the source run value when deriving this limit (10, chapter 5).
|
|
449
|
+
*/
|
|
450
|
+
margin?: {
|
|
451
|
+
/**
|
|
452
|
+
* Multiplier of the source error rate.
|
|
453
|
+
*/
|
|
454
|
+
factor?: number;
|
|
455
|
+
/**
|
|
456
|
+
* Added after multiplying.
|
|
457
|
+
*/
|
|
458
|
+
add?: number;
|
|
459
|
+
/**
|
|
460
|
+
* Minimum derived limit.
|
|
461
|
+
*/
|
|
462
|
+
min?: number;
|
|
463
|
+
};
|
|
464
|
+
};
|
|
465
|
+
};
|
|
466
|
+
/**
|
|
467
|
+
* Gate policy: when violations fail the run (09, D-16, D-17).
|
|
468
|
+
*/
|
|
469
|
+
gate?: {
|
|
470
|
+
/**
|
|
471
|
+
* Number of keys with violations that is still tolerated: an integer, or a percentage of evaluated keys like '5%'. 0: every violation blocks.
|
|
472
|
+
*/
|
|
473
|
+
tolerance?: number | string;
|
|
474
|
+
/**
|
|
475
|
+
* A time check exceeding limit x factor always blocks, regardless of tolerance. Null disables hard limits.
|
|
476
|
+
*/
|
|
477
|
+
hardLimitFactor?: number | null;
|
|
478
|
+
/**
|
|
479
|
+
* 'block': violations on keys evaluated with default thresholds can fail the run; 'warn': they only warn.
|
|
480
|
+
*/
|
|
481
|
+
defaultThresholds?: 'block' | 'warn';
|
|
482
|
+
/**
|
|
483
|
+
* Report violations but never fail the run.
|
|
484
|
+
*/
|
|
485
|
+
warnOnly?: boolean;
|
|
486
|
+
/**
|
|
487
|
+
* 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).
|
|
488
|
+
*/
|
|
489
|
+
maxFailedTestShare?: number;
|
|
490
|
+
};
|
|
491
|
+
/**
|
|
492
|
+
* Thresholds files and derivation (10).
|
|
493
|
+
*/
|
|
494
|
+
thresholds?: {
|
|
495
|
+
/**
|
|
496
|
+
* Directory of thresholds files, relative to the Playwright config directory.
|
|
497
|
+
*/
|
|
498
|
+
dir?: string;
|
|
499
|
+
/**
|
|
500
|
+
* File name prefix; files are <prefix>.<kind>[.<env>].json.
|
|
501
|
+
*/
|
|
502
|
+
filePrefix?: string;
|
|
503
|
+
/**
|
|
504
|
+
* 'all': recompute every unlocked complete entry (with hysteresis, 10); 'new-only': add entries for new keys, keep existing ones.
|
|
505
|
+
*/
|
|
506
|
+
update?: 'all' | 'new-only';
|
|
507
|
+
/**
|
|
508
|
+
* Keys with fewer samples get the small-sample headroom (checks.*.margin.smallSample*) when deriving thresholds (10).
|
|
509
|
+
*/
|
|
510
|
+
smallSampleN?: number;
|
|
511
|
+
/**
|
|
512
|
+
* When re-deriving, an existing unlocked entry keeps its limit if the new value differs by less than this (10-REQ-18). Avoids noise-only diffs.
|
|
513
|
+
*/
|
|
514
|
+
hysteresis?: {
|
|
515
|
+
/**
|
|
516
|
+
* For ms limits: relative difference, e.g. 0.1 = 10%.
|
|
517
|
+
*/
|
|
518
|
+
relative?: number;
|
|
519
|
+
/**
|
|
520
|
+
* For ratio limits: absolute difference. At most 0.01 so a kept entry stays self-consistent (10-REQ-05).
|
|
521
|
+
*/
|
|
522
|
+
ratio?: number;
|
|
523
|
+
};
|
|
524
|
+
/**
|
|
525
|
+
* Warn (THRESHOLDS_LOOSENED_MUCH) when a derived time limit grows by more than this share (10-REQ-20).
|
|
526
|
+
*/
|
|
527
|
+
loosenWarnRelative?: number;
|
|
528
|
+
};
|
|
529
|
+
/**
|
|
530
|
+
* Run outputs (02, 11).
|
|
531
|
+
*/
|
|
532
|
+
report?: {
|
|
533
|
+
/**
|
|
534
|
+
* Directory of report.json and report.html, relative to the Playwright config directory.
|
|
535
|
+
*/
|
|
536
|
+
dir?: string;
|
|
537
|
+
/**
|
|
538
|
+
* Write the HTML report.
|
|
539
|
+
*/
|
|
540
|
+
html?: boolean;
|
|
541
|
+
/**
|
|
542
|
+
* Include raw URLs of the slowest samples in the run report (D-11).
|
|
543
|
+
*/
|
|
544
|
+
rawUrls?: boolean;
|
|
545
|
+
};
|
|
546
|
+
/**
|
|
547
|
+
* Rarely changed settings (08).
|
|
548
|
+
*/
|
|
549
|
+
advanced?: {
|
|
550
|
+
/**
|
|
551
|
+
* Successful durations retained per key (NF-02).
|
|
552
|
+
*/
|
|
553
|
+
maxSamplesPerKey?: number;
|
|
554
|
+
/**
|
|
555
|
+
* Seed of the sampling random generator (P-06).
|
|
556
|
+
*/
|
|
557
|
+
seed?: number;
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Type helpers for the config input type. Functions (keys.keyBuilder) and arrays are replaced
|
|
563
|
+
* as a whole, never mapped over: a mapped function type would lose its call signature.
|
|
564
|
+
*/
|
|
565
|
+
type Whole = readonly unknown[] | ((...args: never[]) => unknown);
|
|
566
|
+
type DeepPartial<T> = T extends readonly (infer U)[] ? U[] : T extends Whole ? T : T extends object ? {
|
|
567
|
+
[K in keyof T]?: DeepPartial<T[K]>;
|
|
568
|
+
} : T;
|
|
569
|
+
type Override<T, U> = {
|
|
570
|
+
[K in keyof T]: K extends keyof U ? U[K] extends Whole ? U[K] : U[K] extends object ? Override<T[K], U[K]> : U[K] : T[K];
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
/** JSON form of the package config: a JSON config file or the snapshot in the run report. */
|
|
574
|
+
type PerfConfigJson = PackageConfig;
|
|
575
|
+
/** A string matches as a case-sensitive substring; RegExp and { regex, flags } are regexes. */
|
|
576
|
+
type UrlPattern = string | RegExp | {
|
|
577
|
+
regex: string;
|
|
578
|
+
flags?: string;
|
|
579
|
+
};
|
|
580
|
+
interface KeyBuilderInput {
|
|
581
|
+
/** Uppercase HTTP method. */
|
|
582
|
+
method: string;
|
|
583
|
+
/** Raw URL. */
|
|
584
|
+
url: string;
|
|
585
|
+
resourceType: string;
|
|
586
|
+
}
|
|
587
|
+
/** Return a key, or undefined to fall back to the built-in normalization (07). */
|
|
588
|
+
type KeyBuilder = (req: KeyBuilderInput) => string | undefined;
|
|
589
|
+
/** Config accepted by definePerfConfig() and withPerf(); every option is optional. */
|
|
590
|
+
type PerfConfigInput = DeepPartial<Override<PerfConfigJson, {
|
|
591
|
+
measure: {
|
|
592
|
+
include: UrlPattern[];
|
|
593
|
+
exclude: UrlPattern[];
|
|
594
|
+
};
|
|
595
|
+
keys: {
|
|
596
|
+
extraIdPatterns: UrlPattern[];
|
|
597
|
+
keyBuilder: KeyBuilder;
|
|
598
|
+
};
|
|
599
|
+
}>>;
|
|
600
|
+
/** Every property required, recursively; arrays and tuples are kept as they are. */
|
|
601
|
+
type Complete<T> = T extends readonly unknown[] ? T : T extends object ? {
|
|
602
|
+
[K in keyof T]-?: Complete<Exclude<T[K], undefined>>;
|
|
603
|
+
} : T;
|
|
604
|
+
type CompleteJson = Complete<Omit<PerfConfigJson, '$schema'>>;
|
|
605
|
+
/**
|
|
606
|
+
* JSON form of a fully resolved config: every option has a value. keys.keyBuilder is present
|
|
607
|
+
* ("[function]") only when a key builder function was configured (02-REQ-17).
|
|
608
|
+
*/
|
|
609
|
+
type ResolvedConfigJson = Omit<CompleteJson, 'keys'> & {
|
|
610
|
+
keys: Omit<CompleteJson['keys'], 'keyBuilder'> & {
|
|
611
|
+
keyBuilder?: '[function]';
|
|
612
|
+
};
|
|
613
|
+
};
|
|
614
|
+
/** A URL pattern after resolution: a substring, or a compiled regular expression. */
|
|
615
|
+
type ResolvedUrlPattern = string | RegExp;
|
|
616
|
+
/** Fully resolved config: all options filled in, patterns compiled (03, chapter 5). */
|
|
617
|
+
type ResolvedConfig = Omit<ResolvedConfigJson, 'measure' | 'keys'> & {
|
|
618
|
+
measure: Omit<ResolvedConfigJson['measure'], 'include' | 'exclude'> & {
|
|
619
|
+
include: ResolvedUrlPattern[];
|
|
620
|
+
exclude: ResolvedUrlPattern[];
|
|
621
|
+
};
|
|
622
|
+
keys: Omit<ResolvedConfigJson['keys'], 'extraIdPatterns' | 'keyBuilder'> & {
|
|
623
|
+
extraIdPatterns: ResolvedUrlPattern[];
|
|
624
|
+
keyBuilder: KeyBuilder | undefined;
|
|
625
|
+
};
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
/** Returns `config` unchanged; it only gives editor type hints in a config file (D-15). */
|
|
629
|
+
declare function definePerfConfig(config: PerfConfigInput): PerfConfigInput;
|
|
630
|
+
/**
|
|
631
|
+
* Fully resolved defaults, deeply frozen. Use them to extend a default list instead of
|
|
632
|
+
* replacing it: `exclude: [...perfDefaults.measure.exclude, 'intercom.io']` (03-REQ-06).
|
|
633
|
+
*/
|
|
634
|
+
declare const perfDefaults: ResolvedConfig;
|
|
635
|
+
|
|
636
|
+
export { definePerfConfig, perfDefaults };
|
|
637
|
+
export type { KeyBuilder, KeyBuilderInput, PerfConfigInput, PerfConfigJson, ResolvedConfig, UrlPattern };
|