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.
Files changed (40) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/README.md +73 -52
  3. package/dist/{chunk-GCA73FFP.cjs → chunk-2JO5HVPC.cjs} +351 -44
  4. package/dist/{chunk-R2NPYGB7.cjs → chunk-44ASXVQN.cjs} +96 -198
  5. package/dist/{chunk-HES6BVZT.js → chunk-AQ2XKYNV.js} +349 -47
  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-UTTU4FUC.js → chunk-MUZFQKGQ.js} +82 -184
  10. package/dist/cli.js +3500 -1157
  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 +5204 -1209
  26. package/dist/reporter.js +2035 -254
  27. package/dist/test.cjs +4 -4
  28. package/dist/test.js +3 -3
  29. package/package.json +5 -3
  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-6AB42SPF.js +0 -254
  37. package/dist/chunk-JEHUFIY3.js +0 -3390
  38. package/dist/chunk-LV3O2BAT.cjs +0 -319
  39. package/dist/perf-api-V4PeHVE0.d.cts +0 -22
  40. 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 chunkLV3O2BAT_cjs = require('./chunk-LV3O2BAT.cjs');
4
- var chunkGCA73FFP_cjs = require('./chunk-GCA73FFP.cjs');
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 = `${chunkLV3O2BAT_cjs.PACKAGE_NAME}/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 (!CONSOLE_REPORTERS.has(name) && !input.keepReporters.includes(name) && !ours(name)) {
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 (!kept.some(([name]) => CONSOLE_REPORTERS.has(name))) {
119
- reporters.push([input.ci ? "dot" : "list"]);
120
- }
121
- reporters.push(...kept);
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, repeat, measured) {
141
+ function overriddenSettings(config, kept) {
126
142
  const scopes = [config, ...kept];
127
- const repeatChanged = kept.length === 0 ? config.repeatEach !== void 0 && config.repeatEach !== repeat : kept.some((p) => {
128
- const own = p.repeatEach ?? config.repeatEach;
129
- return own !== void 0 && own !== (measured.has(projectName(p)) ? repeat : 1);
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
- if (source.projects === void 0) {
192
- result.repeatEach = input.repeat;
193
- } else {
194
- result.projects = kept.map((p) => ({
195
- ...p,
196
- retries: 0,
197
- repeatEach: measuredSet.has(projectName(p)) ? input.repeat : 1,
198
- use: artifactsOff(p.use)
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, input.repeat, measuredSet),
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 mode = chunkLV3O2BAT_cjs.readModeState(process.env);
222
- if (!mode.ok) throw new chunkLV3O2BAT_cjs.ConfigError(mode.issues);
223
- if (mode.value === null) return config;
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 = chunkGCA73FFP_cjs.resolveConfig(perfConfig, {
226
- mode: state.mode,
227
- ...state.repeat === void 0 ? {} : { repeat: state.repeat },
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 chunkLV3O2BAT_cjs.ConfigError(resolved.issues);
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
- repeat: perf.run.repeat[state.mode],
236
- ci: chunkLV3O2BAT_cjs.isCiEnv(process.env),
255
+ grep: perf.run.grep,
237
256
  reporterPath: reporterEntryPath()
238
257
  });
239
- if (!plan.ok) throw new chunkLV3O2BAT_cjs.ConfigError(plan.issues);
240
- chunkLV3O2BAT_cjs.setRegistered({
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: chunkLV3O2BAT_cjs.version,
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 chunkGCA73FFP_cjs.definePerfConfig; }
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. No I/O, no randomness: the result depends only on the arguments and the environment, so
11
- * it is the same in the main process and in the workers (01-REQ-09).
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. No I/O, no randomness: the result depends only on the arguments and the environment, so
11
- * it is the same in the main process and in the workers (01-REQ-09).
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, isCiEnv, version, PACKAGE_NAME } from './chunk-6AB42SPF.js';
3
- import { resolveConfig } from './chunk-HES6BVZT.js';
4
- export { definePerfConfig } from './chunk-HES6BVZT.js';
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 (!CONSOLE_REPORTERS.has(name) && !input.keepReporters.includes(name) && !ours(name)) {
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 (!kept.some(([name]) => CONSOLE_REPORTERS.has(name))) {
119
- reporters.push([input.ci ? "dot" : "list"]);
120
- }
121
- reporters.push(...kept);
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, repeat, measured) {
141
+ function overriddenSettings(config, kept) {
126
142
  const scopes = [config, ...kept];
127
- const repeatChanged = kept.length === 0 ? config.repeatEach !== void 0 && config.repeatEach !== repeat : kept.some((p) => {
128
- const own = p.repeatEach ?? config.repeatEach;
129
- return own !== void 0 && own !== (measured.has(projectName(p)) ? repeat : 1);
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
- if (source.projects === void 0) {
192
- result.repeatEach = input.repeat;
193
- } else {
194
- result.projects = kept.map((p) => ({
195
- ...p,
196
- retries: 0,
197
- repeatEach: measuredSet.has(projectName(p)) ? input.repeat : 1,
198
- use: artifactsOff(p.use)
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, input.repeat, measuredSet),
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 ConfigError(mode.issues);
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.repeat === void 0 ? {} : { repeat: state.repeat },
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
- repeat: perf.run.repeat[state.mode],
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 chunkR2NPYGB7_cjs = require('./chunk-R2NPYGB7.cjs');
4
- require('./chunk-LV3O2BAT.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
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "trackContext", {
10
10
  enumerable: true,
11
- get: function () { return chunkR2NPYGB7_cjs.trackContext; }
11
+ get: function () { return chunk44ASXVQN_cjs.trackContext; }
12
12
  });
13
13
  Object.defineProperty(exports, "withPerfFixtures", {
14
14
  enumerable: true,
15
- get: function () { return chunkR2NPYGB7_cjs.withPerfFixtures; }
15
+ get: function () { return chunk44ASXVQN_cjs.withPerfFixtures; }
16
16
  });
@@ -1,6 +1,6 @@
1
1
  import { TestType, BrowserContext } from '@playwright/test';
2
- import { P as PerfFixtures } from './perf-api-V4PeHVE0.cjs';
3
- export { a as PerfApi } from './perf-api-V4PeHVE0.cjs';
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-V4PeHVE0.js';
3
- export { a as PerfApi } from './perf-api-V4PeHVE0.js';
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-UTTU4FUC.js';
1
+ export { trackContext, withPerfFixtures } from './chunk-MUZFQKGQ.js';
2
2
  import './chunk-DYLCGMI2.js';
3
- import './chunk-6AB42SPF.js';
4
- import './chunk-HES6BVZT.js';
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 chunkGCA73FFP_cjs = require('./chunk-GCA73FFP.cjs');
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 chunkGCA73FFP_cjs.definePerfConfig; }
9
+ get: function () { return chunk2JO5HVPC_cjs.definePerfConfig; }
10
10
  });
11
11
  Object.defineProperty(exports, "perfDefaults", {
12
12
  enumerable: true,
13
- get: function () { return chunkGCA73FFP_cjs.perfDefaults; }
13
+ get: function () { return chunk2JO5HVPC_cjs.perfDefaults; }
14
14
  });