playwright-performance-regression 1.0.1 → 1.1.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 +100 -0
- package/README.md +11 -4
- package/dist/chunk-JS7SBYOF.js +11226 -0
- package/dist/{chunk-ZHJQFWES.js → chunk-PTQWKPHU.js} +276 -11
- package/dist/{chunk-5Y34Q4DR.js → chunk-Q73KMM6D.js} +95 -30
- package/dist/{chunk-CTE5EY35.cjs → chunk-VBNIFMNE.cjs} +298 -32
- package/dist/{chunk-LEIBG5A4.cjs → chunk-VXGTC6DB.cjs} +25 -6
- package/dist/{chunk-W7NEFS5V.cjs → chunk-VYODYUEL.cjs} +95 -29
- package/dist/{chunk-ORWOFAZ5.js → chunk-ZEQ2IGDC.js} +108 -11
- package/dist/cli.js +380 -15
- package/dist/config.cjs +16 -16
- package/dist/config.js +3 -4
- package/dist/fixture.cjs +6 -6
- package/dist/fixture.js +3 -4
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +1 -1
- package/dist/reporter.cjs +1831 -621
- package/dist/reporter.js +7 -8154
- package/dist/test.cjs +4 -4
- package/dist/test.js +3 -4
- package/package.json +3 -3
- package/schemas/config.schema.json +91 -0
- package/schemas/run-report.schema.json +162 -7
- package/schemas/samples.schema.json +12 -3
- package/schemas/thresholds.schema.json +29 -1
- package/dist/chunk-BA37V6SL.js +0 -1803
- package/dist/chunk-S6UH6QPK.js +0 -68
|
@@ -74,7 +74,7 @@ function str(options = {}) {
|
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
76
|
function numeric(integer, options) {
|
|
77
|
-
const { minimum, maximum } = options;
|
|
77
|
+
const { minimum, exclusiveMinimum, maximum } = options;
|
|
78
78
|
const type = integer ? "integer" : "number";
|
|
79
79
|
return {
|
|
80
80
|
expected: type,
|
|
@@ -85,6 +85,9 @@ function numeric(integer, options) {
|
|
|
85
85
|
}
|
|
86
86
|
if (integer && !Number.isInteger(value)) return sink.add(pointer, "must be integer", "type");
|
|
87
87
|
if (minimum !== void 0 && value < minimum) sink.add(pointer, `must be >= ${minimum}`);
|
|
88
|
+
if (exclusiveMinimum !== void 0 && value <= exclusiveMinimum) {
|
|
89
|
+
sink.add(pointer, `must be > ${exclusiveMinimum}`);
|
|
90
|
+
}
|
|
88
91
|
if (maximum !== void 0 && value > maximum) sink.add(pointer, `must be <= ${maximum}`);
|
|
89
92
|
}
|
|
90
93
|
};
|
|
@@ -306,6 +309,7 @@ var DEFAULT_CONFIG = {
|
|
|
306
309
|
exclude: ["/socket.io/", "/sockjs/", "/sockjs-node/", "/signalr/", "/_blazor/"],
|
|
307
310
|
excludeKnownThirdParty: true,
|
|
308
311
|
successStatuses: ["2xx", "3xx"],
|
|
312
|
+
coldSamples: 1,
|
|
309
313
|
steps: true,
|
|
310
314
|
pendingTimeoutMs: 2e3
|
|
311
315
|
},
|
|
@@ -323,7 +327,8 @@ var DEFAULT_CONFIG = {
|
|
|
323
327
|
extraIdPatterns: [],
|
|
324
328
|
query: "names",
|
|
325
329
|
keepQueryValues: [],
|
|
326
|
-
dropQueryParams: []
|
|
330
|
+
dropQueryParams: [],
|
|
331
|
+
operations: []
|
|
327
332
|
},
|
|
328
333
|
checks: {
|
|
329
334
|
time: {
|
|
@@ -371,6 +376,12 @@ var DEFAULT_CONFIG = {
|
|
|
371
376
|
statuses: ["5xx", "FAILED", "PENDING"],
|
|
372
377
|
limit: { api: 0.05, step: 0.05 },
|
|
373
378
|
margin: { factor: 1.5, add: 0.02, min: 0.05 }
|
|
379
|
+
},
|
|
380
|
+
nonSuccess: {
|
|
381
|
+
enabled: true,
|
|
382
|
+
minSamples: 5,
|
|
383
|
+
limit: { api: null },
|
|
384
|
+
margin: { factor: 1.5, add: 0.02, min: 0.05 }
|
|
374
385
|
}
|
|
375
386
|
},
|
|
376
387
|
gate: { tolerance: 0, hardLimitFactor: 2, defaultThresholds: "block", maxFailedTestShare: 0.1 },
|
|
@@ -381,7 +392,8 @@ var DEFAULT_CONFIG = {
|
|
|
381
392
|
update: "all",
|
|
382
393
|
smallSampleN: 20,
|
|
383
394
|
hysteresis: { relative: 0.1, ratio: 0.01 },
|
|
384
|
-
loosenWarnRelative: 0.5
|
|
395
|
+
loosenWarnRelative: 0.5,
|
|
396
|
+
workloadShift: { factor: 2 }
|
|
385
397
|
},
|
|
386
398
|
report: { dir: "reports/pw-perf", html: true, junit: true, rawUrls: false },
|
|
387
399
|
advanced: { maxSamplesPerKey: 5e3, seed: 1 }
|
|
@@ -552,7 +564,9 @@ function presetLayer(preset) {
|
|
|
552
564
|
},
|
|
553
565
|
wilson: { margin: { factor: v.factor } }
|
|
554
566
|
},
|
|
555
|
-
errors: { margin: { factor: v.factor } }
|
|
567
|
+
errors: { margin: { factor: v.factor } },
|
|
568
|
+
// The nonSuccess margin follows the errors margin (03-REQ-30).
|
|
569
|
+
nonSuccess: { margin: { factor: v.factor } }
|
|
556
570
|
}
|
|
557
571
|
};
|
|
558
572
|
}
|
|
@@ -628,6 +642,12 @@ var checks = obj({
|
|
|
628
642
|
),
|
|
629
643
|
limit: limitByKind(ratio),
|
|
630
644
|
margin: errorsMargin
|
|
645
|
+
}),
|
|
646
|
+
nonSuccess: obj({
|
|
647
|
+
enabled,
|
|
648
|
+
minSamples,
|
|
649
|
+
limit: obj({ api: nullable(ratio) }),
|
|
650
|
+
margin: errorsMargin
|
|
631
651
|
})
|
|
632
652
|
});
|
|
633
653
|
var uniqueStrings = (minLength) => arr(str({ minLength }), { uniqueItems: true });
|
|
@@ -679,6 +699,7 @@ var packageConfig = obj({
|
|
|
679
699
|
minItems: 1
|
|
680
700
|
}
|
|
681
701
|
),
|
|
702
|
+
coldSamples: int({ minimum: 0, maximum: 5 }),
|
|
682
703
|
steps: oneOf(
|
|
683
704
|
bool,
|
|
684
705
|
obj({
|
|
@@ -723,7 +744,13 @@ var packageConfig = obj({
|
|
|
723
744
|
query: enumOf(["names", "ignore"]),
|
|
724
745
|
keepQueryValues: uniqueStrings(1),
|
|
725
746
|
dropQueryParams: uniqueStrings(1),
|
|
726
|
-
keyBuilder: constant("[function]")
|
|
747
|
+
keyBuilder: constant("[function]"),
|
|
748
|
+
operations: arr(
|
|
749
|
+
obj(
|
|
750
|
+
{ type: enumOf(["graphql", "trpc"]), match: urlPattern },
|
|
751
|
+
{ required: ["type", "match"] }
|
|
752
|
+
)
|
|
753
|
+
)
|
|
727
754
|
}),
|
|
728
755
|
checks,
|
|
729
756
|
gate: obj({
|
|
@@ -748,7 +775,8 @@ var packageConfig = obj({
|
|
|
748
775
|
update: enumOf(["all", "new-only"]),
|
|
749
776
|
smallSampleN: int({ minimum: 1 }),
|
|
750
777
|
hysteresis: obj({ relative: unit, ratio: num({ minimum: 0, maximum: 0.01 }) }),
|
|
751
|
-
loosenWarnRelative: num({ minimum: 0, maximum: 100 })
|
|
778
|
+
loosenWarnRelative: num({ minimum: 0, maximum: 100 }),
|
|
779
|
+
workloadShift: obj({ factor: nullable(num({ exclusiveMinimum: 1, maximum: 100 })) })
|
|
752
780
|
}),
|
|
753
781
|
report: obj({ dir: str({ minLength: 1 }), html: bool, junit: bool, rawUrls: bool }),
|
|
754
782
|
advanced: obj({
|
|
@@ -770,7 +798,8 @@ var derivationSettings = obj(
|
|
|
770
798
|
p99: p99Margin,
|
|
771
799
|
apdex: apdexMargin,
|
|
772
800
|
wilson: wilsonMargin,
|
|
773
|
-
errors: errorsMargin
|
|
801
|
+
errors: errorsMargin,
|
|
802
|
+
nonSuccess: errorsMargin
|
|
774
803
|
},
|
|
775
804
|
{ required: ["median", "percentile", "p99", "apdex", "wilson", "errors"] }
|
|
776
805
|
)
|
|
@@ -888,7 +917,11 @@ function issue2(code, segments, message, hint) {
|
|
|
888
917
|
const path = formatPath(segments);
|
|
889
918
|
return { code, path, message: `${path === "" ? "config" : path}: ${message}`, hint };
|
|
890
919
|
}
|
|
920
|
+
function isOperationMatch(segments) {
|
|
921
|
+
return segments.length === 4 && segments[0] === "keys" && segments[1] === "operations" && typeof segments[2] === "number" && segments[3] === "match";
|
|
922
|
+
}
|
|
891
923
|
function isPatternItem(segments) {
|
|
924
|
+
if (isOperationMatch(segments)) return true;
|
|
892
925
|
return typeof segments.at(-1) === "number" && PATTERN_LISTS.some(
|
|
893
926
|
(list) => segments.length === list.length + 1 && list.every((name, i) => segments[i] === name)
|
|
894
927
|
);
|
|
@@ -896,6 +929,9 @@ function isPatternItem(segments) {
|
|
|
896
929
|
function knownOptions(parent) {
|
|
897
930
|
if (isPatternItem(parent)) return ["regex", "flags"];
|
|
898
931
|
if (parent[0] === "keys" && parent[1] === "origins") return [];
|
|
932
|
+
if (parent.length === 3 && parent[0] === "keys" && parent[1] === "operations") {
|
|
933
|
+
return ["type", "match"];
|
|
934
|
+
}
|
|
899
935
|
if (parent.length === 2 && parent[0] === "measure" && parent[1] === "steps") {
|
|
900
936
|
return [...STEP_OPTION_NAMES];
|
|
901
937
|
}
|
|
@@ -988,26 +1024,33 @@ function schemaIssues(document) {
|
|
|
988
1024
|
}
|
|
989
1025
|
function regexIssues(document) {
|
|
990
1026
|
const issues = [];
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1027
|
+
const operations = valueAt(document, ["keys", "operations"]);
|
|
1028
|
+
const patterns = [
|
|
1029
|
+
...PATTERN_LISTS.flatMap((path) => {
|
|
1030
|
+
const list = valueAt(document, path);
|
|
1031
|
+
return Array.isArray(list) ? list.map((item, index) => [[...path, index], item]) : [];
|
|
1032
|
+
}),
|
|
1033
|
+
...Array.isArray(operations) ? operations.map((entry, index) => [
|
|
1034
|
+
["keys", "operations", index, "match"],
|
|
1035
|
+
isRecord(entry) ? entry.match : void 0
|
|
1036
|
+
]) : []
|
|
1037
|
+
];
|
|
1038
|
+
for (const [segments, item] of patterns) {
|
|
1039
|
+
if (!isRecord(item) || typeof item.regex !== "string") continue;
|
|
1040
|
+
const flags = typeof item.flags === "string" ? item.flags : "";
|
|
1041
|
+
try {
|
|
1042
|
+
new RegExp(item.regex, flags);
|
|
1043
|
+
} catch (error) {
|
|
1044
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
1045
|
+
issues.push(
|
|
1046
|
+
issue2(
|
|
1047
|
+
"CONFIG_INVALID_REGEX",
|
|
1048
|
+
segments,
|
|
1049
|
+
`regular expression does not compile (${reason})`,
|
|
1050
|
+
'Fix the expression; it uses JavaScript RegExp syntax, e.g. { "regex": "^/api/v[0-9]+/", "flags": "i" }.'
|
|
1051
|
+
)
|
|
1052
|
+
);
|
|
1053
|
+
}
|
|
1011
1054
|
}
|
|
1012
1055
|
const grep = valueAt(document, ["run", "grep"]);
|
|
1013
1056
|
if (typeof grep === "string" && grep !== "") {
|
|
@@ -1101,7 +1144,7 @@ function relationalIssues(config, isSet) {
|
|
|
1101
1144
|
)
|
|
1102
1145
|
);
|
|
1103
1146
|
}
|
|
1104
|
-
for (const rule of RULES.slice(1)) {
|
|
1147
|
+
for (const rule of [...RULES.slice(1), ["checks", "nonSuccess"]]) {
|
|
1105
1148
|
ordered(
|
|
1106
1149
|
["checks", "time", "median", "minSamples"],
|
|
1107
1150
|
[...rule, "minSamples"],
|
|
@@ -1376,6 +1419,7 @@ function resolveConfig(input, overrides) {
|
|
|
1376
1419
|
const list = valueAt(merged, path);
|
|
1377
1420
|
list.splice(0, list.length, ...list.map(snapshotPattern));
|
|
1378
1421
|
}
|
|
1422
|
+
for (const entry of merged.keys.operations) entry.match = snapshotPattern(entry.match);
|
|
1379
1423
|
if (keyBuilder.inSnapshot) merged.keys.keyBuilder = KEY_BUILDER_SNAPSHOT;
|
|
1380
1424
|
const snapshot = merged;
|
|
1381
1425
|
const { keyBuilder: _keyBuilder, ...keys } = snapshot.keys;
|
|
@@ -1395,7 +1439,11 @@ function resolveConfig(input, overrides) {
|
|
|
1395
1439
|
keys: {
|
|
1396
1440
|
...clone(keys),
|
|
1397
1441
|
extraIdPatterns: snapshot.keys.extraIdPatterns.map(compilePattern),
|
|
1398
|
-
keyBuilder: keyBuilder.keyBuilder
|
|
1442
|
+
keyBuilder: keyBuilder.keyBuilder,
|
|
1443
|
+
operations: snapshot.keys.operations.map((entry) => ({
|
|
1444
|
+
type: entry.type,
|
|
1445
|
+
match: compilePattern(entry.match)
|
|
1446
|
+
}))
|
|
1399
1447
|
}
|
|
1400
1448
|
};
|
|
1401
1449
|
return {
|
|
@@ -1426,6 +1474,23 @@ function resolveDefaults() {
|
|
|
1426
1474
|
}
|
|
1427
1475
|
var perfDefaults = deepFreeze(resolveDefaults());
|
|
1428
1476
|
|
|
1477
|
+
// src/core/config/operations.ts
|
|
1478
|
+
function matchEnd(path, pattern) {
|
|
1479
|
+
if (typeof pattern === "string") {
|
|
1480
|
+
const index = path.indexOf(pattern);
|
|
1481
|
+
return index < 0 ? -1 : index + pattern.length;
|
|
1482
|
+
}
|
|
1483
|
+
const found = pattern.exec(path);
|
|
1484
|
+
return found === null ? -1 : found.index + found[0].length;
|
|
1485
|
+
}
|
|
1486
|
+
function matchOperationEntry(entries, path) {
|
|
1487
|
+
for (const entry of entries) {
|
|
1488
|
+
const end = matchEnd(path, entry.match);
|
|
1489
|
+
if (end >= 0) return { entry, end };
|
|
1490
|
+
}
|
|
1491
|
+
return null;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1429
1494
|
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
|
1430
1495
|
exports.Sink = Sink;
|
|
1431
1496
|
exports.anyObject = anyObject;
|
|
@@ -1451,6 +1516,7 @@ exports.isoDate = isoDate;
|
|
|
1451
1516
|
exports.issue = issue;
|
|
1452
1517
|
exports.key = key;
|
|
1453
1518
|
exports.kind = kind;
|
|
1519
|
+
exports.matchOperationEntry = matchOperationEntry;
|
|
1454
1520
|
exports.matchingPattern = matchingPattern;
|
|
1455
1521
|
exports.mode = mode;
|
|
1456
1522
|
exports.ms = ms;
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
// package.json
|
|
2
|
+
var version = "1.1.0";
|
|
3
|
+
var peerDependencies = {
|
|
4
|
+
"@playwright/test": ">=1.57.0"
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/core/types/constants.ts
|
|
2
8
|
var CONTEXT_CLOSED_FAILURE_TEXT = "pw-perf: context closed";
|
|
3
9
|
var ABORT_FAILURE_TEXTS = Object.freeze([
|
|
@@ -27,6 +33,7 @@ var CONFIG_FILE_EXTENSIONS = [
|
|
|
27
33
|
".cjs",
|
|
28
34
|
".json"
|
|
29
35
|
];
|
|
36
|
+
var COLD_WARN_RATIO = 3;
|
|
30
37
|
|
|
31
38
|
// src/core/types/common.ts
|
|
32
39
|
var ConfigError = class extends Error {
|
|
@@ -58,6 +65,7 @@ var LIMIT_NAMES = [
|
|
|
58
65
|
"maxWilson",
|
|
59
66
|
"maxErrorRate"
|
|
60
67
|
];
|
|
68
|
+
var DIFF_LIMIT_NAMES = [...LIMIT_NAMES, "maxNonSuccessRate"];
|
|
61
69
|
var DIFF_CATEGORIES = [
|
|
62
70
|
"added",
|
|
63
71
|
"removed",
|
|
@@ -91,6 +99,8 @@ function limitLabel(limit, level) {
|
|
|
91
99
|
return "wilson";
|
|
92
100
|
case "maxErrorRate":
|
|
93
101
|
return "errors";
|
|
102
|
+
case "maxNonSuccessRate":
|
|
103
|
+
return "nonSuccess";
|
|
94
104
|
default:
|
|
95
105
|
return limit;
|
|
96
106
|
}
|
|
@@ -130,7 +140,12 @@ function diffCountsText(diff) {
|
|
|
130
140
|
let extra = "";
|
|
131
141
|
if (category === "unchanged") {
|
|
132
142
|
const kept = diff.keys.filter((k) => k.withinHysteresis === true).length;
|
|
133
|
-
|
|
143
|
+
const added = diff.keys.filter((k) => k.newFields === true).length;
|
|
144
|
+
const notes = [
|
|
145
|
+
...kept > 0 ? [`${kept} within hysteresis`] : [],
|
|
146
|
+
...added > 0 ? [`${added} +new fields`] : []
|
|
147
|
+
];
|
|
148
|
+
if (notes.length > 0) extra = ` (${notes.join(", ")})`;
|
|
134
149
|
} else if (category === "locked") {
|
|
135
150
|
const incomplete = diff.keys.filter((k) => k.incomplete === true).length;
|
|
136
151
|
if (incomplete > 0)
|
|
@@ -145,9 +160,7 @@ function diffValuesText(diff, side, level, separator) {
|
|
|
145
160
|
const shown = diff.category === "added" === (side === "after");
|
|
146
161
|
if (!shown) return "";
|
|
147
162
|
const limits = diff.limits;
|
|
148
|
-
return
|
|
149
|
-
(name) => `${limitLabel(name, level)} ${limitValueText(name, limits[name])}`
|
|
150
|
-
).join(separator);
|
|
163
|
+
return DIFF_LIMIT_NAMES.filter((name) => name !== "maxNonSuccessRate" || limits[name] !== null).map((name) => `${limitLabel(name, level)} ${limitValueText(name, limits[name])}`).join(separator);
|
|
151
164
|
}
|
|
152
165
|
return diff.changes.map((c) => `${limitLabel(c.limit, level)} ${limitValueText(c.limit, c[side])}`).join(separator);
|
|
153
166
|
}
|
|
@@ -440,6 +453,20 @@ var MAX_TESTS = "PW_PERF_MAX_TESTS";
|
|
|
440
453
|
var LANG = "PW_PERF_LANG";
|
|
441
454
|
var DRY_RUN = "PW_PERF_DRY_RUN";
|
|
442
455
|
var NO_TUTORIAL = "PW_PERF_NO_TUTORIAL";
|
|
456
|
+
var MERGE_MODE = "merge";
|
|
457
|
+
function isMergeMode(env) {
|
|
458
|
+
return read(env, MODE) === MERGE_MODE;
|
|
459
|
+
}
|
|
460
|
+
function mergeIgnoredEnv(env) {
|
|
461
|
+
const out = {};
|
|
462
|
+
const label = read(env, ENV);
|
|
463
|
+
if (label !== void 0) out.env = label;
|
|
464
|
+
const prune = read(env, PRUNE);
|
|
465
|
+
if (prune !== void 0) out.prune = prune;
|
|
466
|
+
const passes = read(env, PASSES);
|
|
467
|
+
if (passes !== void 0) out.passes = passes;
|
|
468
|
+
return out;
|
|
469
|
+
}
|
|
443
470
|
function checkStateFileName(runId) {
|
|
444
471
|
return `playwright-performance-regression-${runId}.check.json`;
|
|
445
472
|
}
|
|
@@ -481,7 +508,16 @@ function readModeState(env) {
|
|
|
481
508
|
const mode = read(env, MODE);
|
|
482
509
|
if (mode === void 0) return { ok: true, value: null };
|
|
483
510
|
const issues = [];
|
|
484
|
-
if (mode
|
|
511
|
+
if (mode === MERGE_MODE) {
|
|
512
|
+
issues.push(
|
|
513
|
+
invalid(
|
|
514
|
+
MODE,
|
|
515
|
+
'"test", "thresholds" or "check"',
|
|
516
|
+
mode,
|
|
517
|
+
"merge runs without tests: PW_PERF_MODE=merge npx pw-perf"
|
|
518
|
+
)
|
|
519
|
+
);
|
|
520
|
+
} else if (mode !== "test" && mode !== "thresholds" && mode !== "check") {
|
|
485
521
|
issues.push(
|
|
486
522
|
invalid(
|
|
487
523
|
MODE,
|
|
@@ -638,10 +674,71 @@ function readInitEnv(env, languages) {
|
|
|
638
674
|
}
|
|
639
675
|
var RUN_ID_ENV = RUN_ID;
|
|
640
676
|
|
|
641
|
-
//
|
|
642
|
-
var
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
677
|
+
// src/registry/index.ts
|
|
678
|
+
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("pw-perf.registry");
|
|
679
|
+
function slot() {
|
|
680
|
+
const global = globalThis;
|
|
681
|
+
let current = global[REGISTRY_KEY];
|
|
682
|
+
if (current === void 0) {
|
|
683
|
+
current = {
|
|
684
|
+
state: void 0,
|
|
685
|
+
wrappedTests: /* @__PURE__ */ new WeakSet(),
|
|
686
|
+
trackedContexts: /* @__PURE__ */ new Set(),
|
|
687
|
+
activeCollector: void 0
|
|
688
|
+
};
|
|
689
|
+
global[REGISTRY_KEY] = current;
|
|
690
|
+
}
|
|
691
|
+
return current;
|
|
692
|
+
}
|
|
693
|
+
function fingerprint(state) {
|
|
694
|
+
return JSON.stringify([
|
|
695
|
+
state.snapshot,
|
|
696
|
+
state.mode,
|
|
697
|
+
state.packageVersion,
|
|
698
|
+
state.measuredProjects,
|
|
699
|
+
state.runConditions
|
|
700
|
+
]);
|
|
701
|
+
}
|
|
702
|
+
function setRegistered(state) {
|
|
703
|
+
const registry = slot();
|
|
704
|
+
const previous = registry.state;
|
|
705
|
+
if (previous !== void 0 && fingerprint(previous) === fingerprint(state)) return void 0;
|
|
706
|
+
registry.state = state;
|
|
707
|
+
if (previous === void 0) return void 0;
|
|
708
|
+
const warning = {
|
|
709
|
+
code: "CONFIG_CHANGED_IN_PROCESS",
|
|
710
|
+
message: "config: withPerf() was called again in this process with a different package config; the last one is used",
|
|
711
|
+
hint: "Apply withPerf() once, to the Playwright config that is run, with one package config."
|
|
712
|
+
};
|
|
713
|
+
state.warnings.push(warning);
|
|
714
|
+
return warning;
|
|
715
|
+
}
|
|
716
|
+
function getRegistered() {
|
|
717
|
+
return slot().state;
|
|
718
|
+
}
|
|
719
|
+
function notWrappedWarning() {
|
|
720
|
+
return {
|
|
721
|
+
code: "NOT_WRAPPED_WITH_PERF",
|
|
722
|
+
message: "config: withPerf() was not applied to the Playwright config in this process, so the default package config is used",
|
|
723
|
+
hint: 'Wrap the Playwright config: export default withPerf(defineConfig({ ... }), perfConfig) with withPerf from "playwright-performance-regression/config".'
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
function wrappedTests() {
|
|
727
|
+
return slot().wrappedTests;
|
|
728
|
+
}
|
|
729
|
+
function trackedContexts() {
|
|
730
|
+
return slot().trackedContexts;
|
|
731
|
+
}
|
|
732
|
+
function wrappedRequestContexts() {
|
|
733
|
+
const registry = slot();
|
|
734
|
+
registry.wrappedRequestContexts ??= /* @__PURE__ */ new WeakSet();
|
|
735
|
+
return registry.wrappedRequestContexts;
|
|
736
|
+
}
|
|
737
|
+
function activeCollector() {
|
|
738
|
+
return slot().activeCollector;
|
|
739
|
+
}
|
|
740
|
+
function setActiveCollector(collector) {
|
|
741
|
+
slot().activeCollector = collector;
|
|
742
|
+
}
|
|
646
743
|
|
|
647
|
-
export { ABORT_FAILURE_TEXTS, CONFIG_FILE_BASENAME, CONFIG_FILE_EXTENSIONS, CONTEXT_CLOSED_FAILURE_TEXT, ConfigError, DEFAULT_MAX_TESTS, DIFF_CATEGORIES, DOCS_CONFIG_URL, INIT_COMMAND, KINDS, LIMIT_NAMES, LISTED_CATEGORIES, PACKAGE_NAME, PRUNE_COMMAND, REPOSITORY_URL, REQUEST_KEY_PREFIX, RUN_ID_ENV, SAMPLES_ATTACHMENT_NAME, THRESHOLDS_COMMAND, argvWarnings, checkStateFileName, diffChangeText, diffCountsText, diffMarker, diffValuesText, generateRunId, isRequestKey, parsePasses, passCommand, peerDependencies, readInitEnv, readModeState, runShape, scriptEnv, skippedReasonText, testArgsFromArgv, testFilters, version, writeModeState };
|
|
744
|
+
export { ABORT_FAILURE_TEXTS, COLD_WARN_RATIO, CONFIG_FILE_BASENAME, CONFIG_FILE_EXTENSIONS, CONTEXT_CLOSED_FAILURE_TEXT, ConfigError, DEFAULT_MAX_TESTS, DIFF_CATEGORIES, DIFF_LIMIT_NAMES, DOCS_CONFIG_URL, INIT_COMMAND, KINDS, LIMIT_NAMES, LISTED_CATEGORIES, PACKAGE_NAME, PRUNE_COMMAND, REPOSITORY_URL, REQUEST_KEY_PREFIX, RUN_ID_ENV, SAMPLES_ATTACHMENT_NAME, THRESHOLDS_COMMAND, activeCollector, argvWarnings, checkStateFileName, diffChangeText, diffCountsText, diffMarker, diffValuesText, generateRunId, getRegistered, isMergeMode, isRequestKey, mergeIgnoredEnv, notWrappedWarning, parsePasses, passCommand, peerDependencies, readInitEnv, readModeState, runShape, scriptEnv, setActiveCollector, setRegistered, skippedReasonText, testArgsFromArgv, testFilters, trackedContexts, version, wrappedRequestContexts, wrappedTests, writeModeState };
|