playwright-performance-regression 0.1.0-next.0 → 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.
- package/CHANGELOG.md +199 -0
- package/README.md +73 -52
- package/dist/{chunk-GCA73FFP.cjs → chunk-2JO5HVPC.cjs} +351 -44
- package/dist/{chunk-R2NPYGB7.cjs → chunk-44ASXVQN.cjs} +96 -198
- package/dist/{chunk-HES6BVZT.js → chunk-AQ2XKYNV.js} +349 -47
- package/dist/chunk-BAOTUUTV.cjs +611 -0
- package/dist/chunk-DX36GFOZ.js +558 -0
- package/dist/chunk-LTRHMBVY.js +5592 -0
- package/dist/{chunk-UTTU4FUC.js → chunk-MUZFQKGQ.js} +82 -184
- package/dist/cli.js +3500 -1157
- package/dist/config.cjs +91 -44
- package/dist/config.d.cts +4 -2
- package/dist/config.d.ts +4 -2
- package/dist/config.js +84 -37
- package/dist/fixture.cjs +5 -5
- package/dist/fixture.d.cts +2 -2
- package/dist/fixture.d.ts +2 -2
- package/dist/fixture.js +3 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +110 -22
- package/dist/index.d.ts +110 -22
- package/dist/index.js +1 -1
- package/dist/perf-api-Rm1h1O_-.d.cts +12 -0
- package/dist/perf-api-Rm1h1O_-.d.ts +12 -0
- package/dist/reporter.cjs +5204 -1209
- package/dist/reporter.js +2035 -254
- package/dist/test.cjs +4 -4
- package/dist/test.js +3 -3
- package/package.json +5 -3
- package/schemas/common.schema.json +2 -2
- package/schemas/config.schema.json +57 -21
- package/schemas/outcome.schema.json +1 -1
- package/schemas/run-report.schema.json +534 -19
- package/schemas/samples.schema.json +4 -39
- package/schemas/thresholds.schema.json +1 -1
- package/dist/chunk-6AB42SPF.js +0 -254
- package/dist/chunk-JEHUFIY3.js +0 -3390
- package/dist/chunk-LV3O2BAT.cjs +0 -319
- package/dist/perf-api-V4PeHVE0.d.cts +0 -22
- package/dist/perf-api-V4PeHVE0.d.ts +0 -22
package/dist/config.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
3
|
+
var chunkBAOTUUTV_cjs = require('./chunk-BAOTUUTV.cjs');
|
|
4
|
+
var chunk2JO5HVPC_cjs = require('./chunk-2JO5HVPC.cjs');
|
|
5
5
|
|
|
6
6
|
// src/config/reporter-path.ts
|
|
7
7
|
function currentFile() {
|
|
@@ -20,7 +20,7 @@ function reporterEntryPath() {
|
|
|
20
20
|
// src/config/run-conditions.ts
|
|
21
21
|
var CONSOLE_REPORTERS = /* @__PURE__ */ new Set(["list", "line", "dot", "github"]);
|
|
22
22
|
var ARTIFACTS = ["trace", "video", "screenshot"];
|
|
23
|
-
var PACKAGE_REPORTER = `${
|
|
23
|
+
var PACKAGE_REPORTER = `${chunkBAOTUUTV_cjs.PACKAGE_NAME}/reporter`;
|
|
24
24
|
function projectName(project) {
|
|
25
25
|
return project.name ?? "";
|
|
26
26
|
}
|
|
@@ -41,6 +41,18 @@ function positive(value) {
|
|
|
41
41
|
function artifactsOff(use) {
|
|
42
42
|
return { ...use, trace: "off", video: "off", screenshot: "off" };
|
|
43
43
|
}
|
|
44
|
+
function andGrep(extra, own) {
|
|
45
|
+
if (own === void 0) return new RegExp(extra, "i");
|
|
46
|
+
const list = Array.isArray(own) ? own : [own];
|
|
47
|
+
const flags = /* @__PURE__ */ new Set(["i", ...list.flatMap((re) => [...re.flags])]);
|
|
48
|
+
flags.delete("g");
|
|
49
|
+
flags.delete("y");
|
|
50
|
+
const ownSource = list.map((re) => `(?:${re.source})`).join("|");
|
|
51
|
+
return new RegExp(
|
|
52
|
+
`^(?=[\\s\\S]*?(?:${extra}))(?=[\\s\\S]*?(?:${ownSource}))`,
|
|
53
|
+
[...flags].sort().join("")
|
|
54
|
+
);
|
|
55
|
+
}
|
|
44
56
|
function measuredNames(config, projects, option) {
|
|
45
57
|
const names = projects.map(projectName);
|
|
46
58
|
if (option !== "auto") {
|
|
@@ -104,9 +116,13 @@ function planReporters(reporter, input) {
|
|
|
104
116
|
const ours = (name) => name === input.reporterPath || name === PACKAGE_REPORTER;
|
|
105
117
|
const kept = [];
|
|
106
118
|
const removed = [];
|
|
119
|
+
const replaced = [];
|
|
107
120
|
for (const entry of reporterEntries(reporter)) {
|
|
108
121
|
const [name, options] = entry;
|
|
109
|
-
if (
|
|
122
|
+
if (name === "list" && !input.keepReporters.includes(name)) {
|
|
123
|
+
if (!replaced.includes(name)) replaced.push(name);
|
|
124
|
+
kept.push(["dot"]);
|
|
125
|
+
} else if (!CONSOLE_REPORTERS.has(name) && !input.keepReporters.includes(name) && !ours(name)) {
|
|
110
126
|
removed.push(name);
|
|
111
127
|
} else if (name === "html") {
|
|
112
128
|
kept.push([name, { ...options, open: "never" }]);
|
|
@@ -114,23 +130,21 @@ function planReporters(reporter, input) {
|
|
|
114
130
|
kept.push(entry);
|
|
115
131
|
}
|
|
116
132
|
}
|
|
133
|
+
const firstDot = kept.findIndex(([name]) => name === "dot");
|
|
134
|
+
const deduped = kept.filter(([name], i) => name !== "dot" || i === firstDot);
|
|
117
135
|
const reporters = [];
|
|
118
|
-
if (!
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
reporters
|
|
122
|
-
if (!kept.some(([name]) => ours(name))) reporters.push([input.reporterPath]);
|
|
123
|
-
return { reporters, removed };
|
|
136
|
+
if (!deduped.some(([name]) => CONSOLE_REPORTERS.has(name))) reporters.push(["dot"]);
|
|
137
|
+
reporters.push(...deduped);
|
|
138
|
+
if (!deduped.some(([name]) => ours(name))) reporters.push([input.reporterPath]);
|
|
139
|
+
return { reporters, removed, replaced };
|
|
124
140
|
}
|
|
125
|
-
function overriddenSettings(config, kept
|
|
141
|
+
function overriddenSettings(config, kept) {
|
|
126
142
|
const scopes = [config, ...kept];
|
|
127
|
-
const repeatChanged =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
143
|
+
const repeatChanged = [config, ...kept].some(
|
|
144
|
+
(scope) => scope.repeatEach !== void 0 && scope.repeatEach !== 1
|
|
145
|
+
);
|
|
131
146
|
const changed = [
|
|
132
147
|
["workers", config.workers !== 1],
|
|
133
|
-
["retries", scopes.some((scope) => positive(scope.retries))],
|
|
134
148
|
["repeatEach", repeatChanged],
|
|
135
149
|
["maxFailures", positive(config.maxFailures)],
|
|
136
150
|
["globalTimeout", positive(config.globalTimeout)],
|
|
@@ -174,29 +188,31 @@ function planPerfRun(config, input) {
|
|
|
174
188
|
const projects = source.projects ?? [{}];
|
|
175
189
|
const measured = measuredNames(source, projects, input.projects);
|
|
176
190
|
if (!measured.ok) return measured;
|
|
177
|
-
const measuredSet = new Set(measured.value);
|
|
178
191
|
const keep = projectsToKeep(projects, measured.value);
|
|
179
192
|
const kept = source.projects === void 0 ? [] : projects.filter((p) => keep.has(projectName(p)));
|
|
180
193
|
const removedProjects = source.projects === void 0 ? [] : projects.filter((p) => !keep.has(projectName(p))).map(projectName);
|
|
181
|
-
const { reporters, removed } = planReporters(source.reporter, input);
|
|
194
|
+
const { reporters, removed, replaced } = planReporters(source.reporter, input);
|
|
182
195
|
const result = {
|
|
183
196
|
...source,
|
|
184
197
|
workers: 1,
|
|
185
|
-
retries: 0,
|
|
186
198
|
maxFailures: 0,
|
|
187
199
|
globalTimeout: 0,
|
|
188
200
|
use: artifactsOff(source.use),
|
|
189
201
|
reporter: reporters
|
|
190
202
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
result.repeatEach = 1;
|
|
204
|
+
const grep = input.grep ?? null;
|
|
205
|
+
if (source.projects !== void 0) {
|
|
206
|
+
const measuredSet = new Set(measured.value);
|
|
207
|
+
result.projects = kept.map((p) => {
|
|
208
|
+
const project = { ...p, repeatEach: 1, use: artifactsOff(p.use) };
|
|
209
|
+
if (grep !== null && measuredSet.has(projectName(p))) {
|
|
210
|
+
project.grep = andGrep(grep, p.grep ?? source.grep);
|
|
211
|
+
}
|
|
212
|
+
return project;
|
|
213
|
+
});
|
|
214
|
+
} else if (grep !== null) {
|
|
215
|
+
result.grep = andGrep(grep, source.grep);
|
|
200
216
|
}
|
|
201
217
|
return {
|
|
202
218
|
ok: true,
|
|
@@ -204,9 +220,10 @@ function planPerfRun(config, input) {
|
|
|
204
220
|
config: result,
|
|
205
221
|
measuredProjects: measured.value,
|
|
206
222
|
runConditions: {
|
|
207
|
-
overridden: overriddenSettings(source, kept
|
|
223
|
+
overridden: overriddenSettings(source, kept),
|
|
208
224
|
removedProjects,
|
|
209
|
-
removedReporters: removed
|
|
225
|
+
removedReporters: removed,
|
|
226
|
+
replacedReporters: replaced
|
|
210
227
|
},
|
|
211
228
|
warnings: [
|
|
212
229
|
...enginesWarnings(source, projects, measured.value),
|
|
@@ -218,39 +235,69 @@ function planPerfRun(config, input) {
|
|
|
218
235
|
|
|
219
236
|
// src/config/with-perf.ts
|
|
220
237
|
function withPerf(config, perfConfig) {
|
|
221
|
-
const
|
|
222
|
-
if (!
|
|
223
|
-
if (
|
|
238
|
+
const first = chunkBAOTUUTV_cjs.readModeState(process.env);
|
|
239
|
+
if (!first.ok) throw new chunkBAOTUUTV_cjs.ConfigError(first.issues);
|
|
240
|
+
if (first.value === null) return config;
|
|
241
|
+
const argvIssues = mainProcessSetup(first.value.outcomeFile === void 0);
|
|
242
|
+
const mode = chunkBAOTUUTV_cjs.readModeState(process.env);
|
|
243
|
+
if (!mode.ok || mode.value === null) throw new Error("withPerf: the mode state changed");
|
|
224
244
|
const state = mode.value;
|
|
225
|
-
const resolved =
|
|
226
|
-
mode: state.mode,
|
|
227
|
-
...state
|
|
245
|
+
const resolved = chunk2JO5HVPC_cjs.resolveConfig(perfConfig, {
|
|
246
|
+
mode: state.mode === "check" ? "test" : state.mode,
|
|
247
|
+
...passesOverride(state),
|
|
228
248
|
...state.env === void 0 ? {} : { env: state.env }
|
|
229
249
|
});
|
|
230
|
-
if (!resolved.ok) throw new
|
|
250
|
+
if (!resolved.ok) throw new chunkBAOTUUTV_cjs.ConfigError(resolved.issues);
|
|
231
251
|
const { config: perf, snapshot, warnings } = resolved.value;
|
|
232
252
|
const plan = planPerfRun(config, {
|
|
233
253
|
projects: perf.run.projects,
|
|
234
254
|
keepReporters: perf.run.keepReporters,
|
|
235
|
-
|
|
236
|
-
ci: chunkLV3O2BAT_cjs.isCiEnv(process.env),
|
|
255
|
+
grep: perf.run.grep,
|
|
237
256
|
reporterPath: reporterEntryPath()
|
|
238
257
|
});
|
|
239
|
-
if (!plan.ok) throw new
|
|
240
|
-
|
|
258
|
+
if (!plan.ok) throw new chunkBAOTUUTV_cjs.ConfigError(plan.issues);
|
|
259
|
+
chunkBAOTUUTV_cjs.setRegistered({
|
|
241
260
|
config: perf,
|
|
242
261
|
snapshot,
|
|
243
262
|
mode: state,
|
|
244
|
-
packageVersion:
|
|
263
|
+
packageVersion: chunkBAOTUUTV_cjs.version,
|
|
245
264
|
measuredProjects: plan.value.measuredProjects,
|
|
246
265
|
runConditions: plan.value.runConditions,
|
|
247
|
-
warnings: [...warnings, ...plan.value.warnings]
|
|
266
|
+
warnings: [...warnings, ...plan.value.warnings, ...argvIssues]
|
|
248
267
|
});
|
|
249
268
|
return plan.value.config;
|
|
250
269
|
}
|
|
270
|
+
function passesOverride(state) {
|
|
271
|
+
if (state.mode === "check") return {};
|
|
272
|
+
if (state.pass !== void 0) return { passes: state.pass.total };
|
|
273
|
+
return state.passes === void 0 ? {} : { passes: state.passes };
|
|
274
|
+
}
|
|
275
|
+
var SETUP_DONE = /* @__PURE__ */ Symbol.for("playwright-performance-regression.mainProcessSetup");
|
|
276
|
+
function mainProcessSetup(environmentMode) {
|
|
277
|
+
if (!environmentMode || process.env.TEST_WORKER_INDEX !== void 0) return [];
|
|
278
|
+
const store = globalThis;
|
|
279
|
+
const done = store[SETUP_DONE];
|
|
280
|
+
if (done !== void 0) return done;
|
|
281
|
+
if ((process.env[chunkBAOTUUTV_cjs.RUN_ID_ENV] ?? "") === "") {
|
|
282
|
+
process.env[chunkBAOTUUTV_cjs.RUN_ID_ENV] = chunkBAOTUUTV_cjs.generateRunId(/* @__PURE__ */ new Date(), Math.random);
|
|
283
|
+
}
|
|
284
|
+
const found = chunkBAOTUUTV_cjs.argvWarnings(process.argv, chunkBAOTUUTV_cjs.PACKAGE_NAME);
|
|
285
|
+
const report = [];
|
|
286
|
+
for (const issue of [found.reporter, found.unsupported]) {
|
|
287
|
+
if (issue === null) continue;
|
|
288
|
+
process.stderr.write(
|
|
289
|
+
`${chunkBAOTUUTV_cjs.PACKAGE_NAME}: warning ${issue.code}: ${issue.message}
|
|
290
|
+
Hint: ${issue.hint}
|
|
291
|
+
`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
if (found.unsupported !== null) report.push(found.unsupported);
|
|
295
|
+
store[SETUP_DONE] = report;
|
|
296
|
+
return report;
|
|
297
|
+
}
|
|
251
298
|
|
|
252
299
|
Object.defineProperty(exports, "definePerfConfig", {
|
|
253
300
|
enumerable: true,
|
|
254
|
-
get: function () { return
|
|
301
|
+
get: function () { return chunk2JO5HVPC_cjs.definePerfConfig; }
|
|
255
302
|
});
|
|
256
303
|
exports.withPerf = withPerf;
|
package/dist/config.d.cts
CHANGED
|
@@ -7,8 +7,10 @@ import { PlaywrightTestConfig } from '@playwright/test';
|
|
|
7
7
|
* else (01-REQ-08, P-02). In perf mode it resolves the package config, registers it for the
|
|
8
8
|
* reporter and the fixtures of this process and returns a copy of `config` with the run
|
|
9
9
|
* conditions of perf mode; invalid config or mode variables throw ConfigError before any test
|
|
10
|
-
* runs.
|
|
11
|
-
*
|
|
10
|
+
* runs. The returned config depends only on the arguments and the environment, so it is the same
|
|
11
|
+
* in the main process and in the workers (01-REQ-09). Only in the main process of the
|
|
12
|
+
* environment mode (no CLI) it sets PW_PERF_RUN_ID for the workers and warns about arguments
|
|
13
|
+
* (04-REQ-60, 04-REQ-61).
|
|
12
14
|
*/
|
|
13
15
|
declare function withPerf<T extends PlaywrightTestConfig>(config: T, perfConfig?: PerfConfigInput): T;
|
|
14
16
|
|
package/dist/config.d.ts
CHANGED
|
@@ -7,8 +7,10 @@ import { PlaywrightTestConfig } from '@playwright/test';
|
|
|
7
7
|
* else (01-REQ-08, P-02). In perf mode it resolves the package config, registers it for the
|
|
8
8
|
* reporter and the fixtures of this process and returns a copy of `config` with the run
|
|
9
9
|
* conditions of perf mode; invalid config or mode variables throw ConfigError before any test
|
|
10
|
-
* runs.
|
|
11
|
-
*
|
|
10
|
+
* runs. The returned config depends only on the arguments and the environment, so it is the same
|
|
11
|
+
* in the main process and in the workers (01-REQ-09). Only in the main process of the
|
|
12
|
+
* environment mode (no CLI) it sets PW_PERF_RUN_ID for the workers and warns about arguments
|
|
13
|
+
* (04-REQ-60, 04-REQ-61).
|
|
12
14
|
*/
|
|
13
15
|
declare function withPerf<T extends PlaywrightTestConfig>(config: T, perfConfig?: PerfConfigInput): T;
|
|
14
16
|
|
package/dist/config.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setRegistered } from './chunk-DYLCGMI2.js';
|
|
2
|
-
import { readModeState, ConfigError,
|
|
3
|
-
import { resolveConfig } from './chunk-
|
|
4
|
-
export { definePerfConfig } from './chunk-
|
|
2
|
+
import { readModeState, ConfigError, version, RUN_ID_ENV, generateRunId, argvWarnings, PACKAGE_NAME } from './chunk-DX36GFOZ.js';
|
|
3
|
+
import { resolveConfig } from './chunk-AQ2XKYNV.js';
|
|
4
|
+
export { definePerfConfig } from './chunk-AQ2XKYNV.js';
|
|
5
5
|
|
|
6
6
|
// src/config/reporter-path.ts
|
|
7
7
|
function currentFile() {
|
|
@@ -41,6 +41,18 @@ function positive(value) {
|
|
|
41
41
|
function artifactsOff(use) {
|
|
42
42
|
return { ...use, trace: "off", video: "off", screenshot: "off" };
|
|
43
43
|
}
|
|
44
|
+
function andGrep(extra, own) {
|
|
45
|
+
if (own === void 0) return new RegExp(extra, "i");
|
|
46
|
+
const list = Array.isArray(own) ? own : [own];
|
|
47
|
+
const flags = /* @__PURE__ */ new Set(["i", ...list.flatMap((re) => [...re.flags])]);
|
|
48
|
+
flags.delete("g");
|
|
49
|
+
flags.delete("y");
|
|
50
|
+
const ownSource = list.map((re) => `(?:${re.source})`).join("|");
|
|
51
|
+
return new RegExp(
|
|
52
|
+
`^(?=[\\s\\S]*?(?:${extra}))(?=[\\s\\S]*?(?:${ownSource}))`,
|
|
53
|
+
[...flags].sort().join("")
|
|
54
|
+
);
|
|
55
|
+
}
|
|
44
56
|
function measuredNames(config, projects, option) {
|
|
45
57
|
const names = projects.map(projectName);
|
|
46
58
|
if (option !== "auto") {
|
|
@@ -104,9 +116,13 @@ function planReporters(reporter, input) {
|
|
|
104
116
|
const ours = (name) => name === input.reporterPath || name === PACKAGE_REPORTER;
|
|
105
117
|
const kept = [];
|
|
106
118
|
const removed = [];
|
|
119
|
+
const replaced = [];
|
|
107
120
|
for (const entry of reporterEntries(reporter)) {
|
|
108
121
|
const [name, options] = entry;
|
|
109
|
-
if (
|
|
122
|
+
if (name === "list" && !input.keepReporters.includes(name)) {
|
|
123
|
+
if (!replaced.includes(name)) replaced.push(name);
|
|
124
|
+
kept.push(["dot"]);
|
|
125
|
+
} else if (!CONSOLE_REPORTERS.has(name) && !input.keepReporters.includes(name) && !ours(name)) {
|
|
110
126
|
removed.push(name);
|
|
111
127
|
} else if (name === "html") {
|
|
112
128
|
kept.push([name, { ...options, open: "never" }]);
|
|
@@ -114,23 +130,21 @@ function planReporters(reporter, input) {
|
|
|
114
130
|
kept.push(entry);
|
|
115
131
|
}
|
|
116
132
|
}
|
|
133
|
+
const firstDot = kept.findIndex(([name]) => name === "dot");
|
|
134
|
+
const deduped = kept.filter(([name], i) => name !== "dot" || i === firstDot);
|
|
117
135
|
const reporters = [];
|
|
118
|
-
if (!
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
reporters
|
|
122
|
-
if (!kept.some(([name]) => ours(name))) reporters.push([input.reporterPath]);
|
|
123
|
-
return { reporters, removed };
|
|
136
|
+
if (!deduped.some(([name]) => CONSOLE_REPORTERS.has(name))) reporters.push(["dot"]);
|
|
137
|
+
reporters.push(...deduped);
|
|
138
|
+
if (!deduped.some(([name]) => ours(name))) reporters.push([input.reporterPath]);
|
|
139
|
+
return { reporters, removed, replaced };
|
|
124
140
|
}
|
|
125
|
-
function overriddenSettings(config, kept
|
|
141
|
+
function overriddenSettings(config, kept) {
|
|
126
142
|
const scopes = [config, ...kept];
|
|
127
|
-
const repeatChanged =
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
});
|
|
143
|
+
const repeatChanged = [config, ...kept].some(
|
|
144
|
+
(scope) => scope.repeatEach !== void 0 && scope.repeatEach !== 1
|
|
145
|
+
);
|
|
131
146
|
const changed = [
|
|
132
147
|
["workers", config.workers !== 1],
|
|
133
|
-
["retries", scopes.some((scope) => positive(scope.retries))],
|
|
134
148
|
["repeatEach", repeatChanged],
|
|
135
149
|
["maxFailures", positive(config.maxFailures)],
|
|
136
150
|
["globalTimeout", positive(config.globalTimeout)],
|
|
@@ -174,29 +188,31 @@ function planPerfRun(config, input) {
|
|
|
174
188
|
const projects = source.projects ?? [{}];
|
|
175
189
|
const measured = measuredNames(source, projects, input.projects);
|
|
176
190
|
if (!measured.ok) return measured;
|
|
177
|
-
const measuredSet = new Set(measured.value);
|
|
178
191
|
const keep = projectsToKeep(projects, measured.value);
|
|
179
192
|
const kept = source.projects === void 0 ? [] : projects.filter((p) => keep.has(projectName(p)));
|
|
180
193
|
const removedProjects = source.projects === void 0 ? [] : projects.filter((p) => !keep.has(projectName(p))).map(projectName);
|
|
181
|
-
const { reporters, removed } = planReporters(source.reporter, input);
|
|
194
|
+
const { reporters, removed, replaced } = planReporters(source.reporter, input);
|
|
182
195
|
const result = {
|
|
183
196
|
...source,
|
|
184
197
|
workers: 1,
|
|
185
|
-
retries: 0,
|
|
186
198
|
maxFailures: 0,
|
|
187
199
|
globalTimeout: 0,
|
|
188
200
|
use: artifactsOff(source.use),
|
|
189
201
|
reporter: reporters
|
|
190
202
|
};
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
203
|
+
result.repeatEach = 1;
|
|
204
|
+
const grep = input.grep ?? null;
|
|
205
|
+
if (source.projects !== void 0) {
|
|
206
|
+
const measuredSet = new Set(measured.value);
|
|
207
|
+
result.projects = kept.map((p) => {
|
|
208
|
+
const project = { ...p, repeatEach: 1, use: artifactsOff(p.use) };
|
|
209
|
+
if (grep !== null && measuredSet.has(projectName(p))) {
|
|
210
|
+
project.grep = andGrep(grep, p.grep ?? source.grep);
|
|
211
|
+
}
|
|
212
|
+
return project;
|
|
213
|
+
});
|
|
214
|
+
} else if (grep !== null) {
|
|
215
|
+
result.grep = andGrep(grep, source.grep);
|
|
200
216
|
}
|
|
201
217
|
return {
|
|
202
218
|
ok: true,
|
|
@@ -204,9 +220,10 @@ function planPerfRun(config, input) {
|
|
|
204
220
|
config: result,
|
|
205
221
|
measuredProjects: measured.value,
|
|
206
222
|
runConditions: {
|
|
207
|
-
overridden: overriddenSettings(source, kept
|
|
223
|
+
overridden: overriddenSettings(source, kept),
|
|
208
224
|
removedProjects,
|
|
209
|
-
removedReporters: removed
|
|
225
|
+
removedReporters: removed,
|
|
226
|
+
replacedReporters: replaced
|
|
210
227
|
},
|
|
211
228
|
warnings: [
|
|
212
229
|
...enginesWarnings(source, projects, measured.value),
|
|
@@ -218,13 +235,16 @@ function planPerfRun(config, input) {
|
|
|
218
235
|
|
|
219
236
|
// src/config/with-perf.ts
|
|
220
237
|
function withPerf(config, perfConfig) {
|
|
238
|
+
const first = readModeState(process.env);
|
|
239
|
+
if (!first.ok) throw new ConfigError(first.issues);
|
|
240
|
+
if (first.value === null) return config;
|
|
241
|
+
const argvIssues = mainProcessSetup(first.value.outcomeFile === void 0);
|
|
221
242
|
const mode = readModeState(process.env);
|
|
222
|
-
if (!mode.ok) throw new
|
|
223
|
-
if (mode.value === null) return config;
|
|
243
|
+
if (!mode.ok || mode.value === null) throw new Error("withPerf: the mode state changed");
|
|
224
244
|
const state = mode.value;
|
|
225
245
|
const resolved = resolveConfig(perfConfig, {
|
|
226
|
-
mode: state.mode,
|
|
227
|
-
...state
|
|
246
|
+
mode: state.mode === "check" ? "test" : state.mode,
|
|
247
|
+
...passesOverride(state),
|
|
228
248
|
...state.env === void 0 ? {} : { env: state.env }
|
|
229
249
|
});
|
|
230
250
|
if (!resolved.ok) throw new ConfigError(resolved.issues);
|
|
@@ -232,8 +252,7 @@ function withPerf(config, perfConfig) {
|
|
|
232
252
|
const plan = planPerfRun(config, {
|
|
233
253
|
projects: perf.run.projects,
|
|
234
254
|
keepReporters: perf.run.keepReporters,
|
|
235
|
-
|
|
236
|
-
ci: isCiEnv(process.env),
|
|
255
|
+
grep: perf.run.grep,
|
|
237
256
|
reporterPath: reporterEntryPath()
|
|
238
257
|
});
|
|
239
258
|
if (!plan.ok) throw new ConfigError(plan.issues);
|
|
@@ -244,9 +263,37 @@ function withPerf(config, perfConfig) {
|
|
|
244
263
|
packageVersion: version,
|
|
245
264
|
measuredProjects: plan.value.measuredProjects,
|
|
246
265
|
runConditions: plan.value.runConditions,
|
|
247
|
-
warnings: [...warnings, ...plan.value.warnings]
|
|
266
|
+
warnings: [...warnings, ...plan.value.warnings, ...argvIssues]
|
|
248
267
|
});
|
|
249
268
|
return plan.value.config;
|
|
250
269
|
}
|
|
270
|
+
function passesOverride(state) {
|
|
271
|
+
if (state.mode === "check") return {};
|
|
272
|
+
if (state.pass !== void 0) return { passes: state.pass.total };
|
|
273
|
+
return state.passes === void 0 ? {} : { passes: state.passes };
|
|
274
|
+
}
|
|
275
|
+
var SETUP_DONE = /* @__PURE__ */ Symbol.for("playwright-performance-regression.mainProcessSetup");
|
|
276
|
+
function mainProcessSetup(environmentMode) {
|
|
277
|
+
if (!environmentMode || process.env.TEST_WORKER_INDEX !== void 0) return [];
|
|
278
|
+
const store = globalThis;
|
|
279
|
+
const done = store[SETUP_DONE];
|
|
280
|
+
if (done !== void 0) return done;
|
|
281
|
+
if ((process.env[RUN_ID_ENV] ?? "") === "") {
|
|
282
|
+
process.env[RUN_ID_ENV] = generateRunId(/* @__PURE__ */ new Date(), Math.random);
|
|
283
|
+
}
|
|
284
|
+
const found = argvWarnings(process.argv, PACKAGE_NAME);
|
|
285
|
+
const report = [];
|
|
286
|
+
for (const issue of [found.reporter, found.unsupported]) {
|
|
287
|
+
if (issue === null) continue;
|
|
288
|
+
process.stderr.write(
|
|
289
|
+
`${PACKAGE_NAME}: warning ${issue.code}: ${issue.message}
|
|
290
|
+
Hint: ${issue.hint}
|
|
291
|
+
`
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
if (found.unsupported !== null) report.push(found.unsupported);
|
|
295
|
+
store[SETUP_DONE] = report;
|
|
296
|
+
return report;
|
|
297
|
+
}
|
|
251
298
|
|
|
252
299
|
export { withPerf };
|
package/dist/fixture.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
5
|
-
require('./chunk-
|
|
3
|
+
var chunk44ASXVQN_cjs = require('./chunk-44ASXVQN.cjs');
|
|
4
|
+
require('./chunk-BAOTUUTV.cjs');
|
|
5
|
+
require('./chunk-2JO5HVPC.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
Object.defineProperty(exports, "trackContext", {
|
|
10
10
|
enumerable: true,
|
|
11
|
-
get: function () { return
|
|
11
|
+
get: function () { return chunk44ASXVQN_cjs.trackContext; }
|
|
12
12
|
});
|
|
13
13
|
Object.defineProperty(exports, "withPerfFixtures", {
|
|
14
14
|
enumerable: true,
|
|
15
|
-
get: function () { return
|
|
15
|
+
get: function () { return chunk44ASXVQN_cjs.withPerfFixtures; }
|
|
16
16
|
});
|
package/dist/fixture.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TestType, BrowserContext } from '@playwright/test';
|
|
2
|
-
import { P as PerfFixtures } from './perf-api-
|
|
3
|
-
export { a as PerfApi } from './perf-api-
|
|
2
|
+
import { P as PerfFixtures } from './perf-api-Rm1h1O_-.cjs';
|
|
3
|
+
export { a as PerfApi } from './perf-api-Rm1h1O_-.cjs';
|
|
4
4
|
|
|
5
5
|
/** `base` with the `perf` fixture added; other fixtures and options keep their types. */
|
|
6
6
|
type PerfTestType<T> = T extends TestType<infer TestArgs, infer WorkerArgs> ? TestType<TestArgs & PerfFixtures, WorkerArgs> : never;
|
package/dist/fixture.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TestType, BrowserContext } from '@playwright/test';
|
|
2
|
-
import { P as PerfFixtures } from './perf-api-
|
|
3
|
-
export { a as PerfApi } from './perf-api-
|
|
2
|
+
import { P as PerfFixtures } from './perf-api-Rm1h1O_-.js';
|
|
3
|
+
export { a as PerfApi } from './perf-api-Rm1h1O_-.js';
|
|
4
4
|
|
|
5
5
|
/** `base` with the `perf` fixture added; other fixtures and options keep their types. */
|
|
6
6
|
type PerfTestType<T> = T extends TestType<infer TestArgs, infer WorkerArgs> ? TestType<TestArgs & PerfFixtures, WorkerArgs> : never;
|
package/dist/fixture.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { trackContext, withPerfFixtures } from './chunk-
|
|
1
|
+
export { trackContext, withPerfFixtures } from './chunk-MUZFQKGQ.js';
|
|
2
2
|
import './chunk-DYLCGMI2.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
import './chunk-DX36GFOZ.js';
|
|
4
|
+
import './chunk-AQ2XKYNV.js';
|
package/dist/index.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2JO5HVPC_cjs = require('./chunk-2JO5HVPC.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "definePerfConfig", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk2JO5HVPC_cjs.definePerfConfig; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "perfDefaults", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk2JO5HVPC_cjs.perfDefaults; }
|
|
14
14
|
});
|