playwright-performance-regression 1.0.0 → 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/dist/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { readTextFile, colorEnabled, painter, asciiTerminal, box, marks, paint, stringifyStable, SCHEMA_VERSIONS } from './chunk-B4XTLSRN.js';
3
- import { INIT_COMMAND, CONFIG_FILE_EXTENSIONS, CONFIG_FILE_BASENAME, readInitEnv, PACKAGE_NAME, REPOSITORY_URL, peerDependencies, parsePasses, writeModeState, DOCS_CONFIG_URL } from './chunk-YKBX6SAT.js';
4
- import { DEFAULT_CONFIG, resolveConfig, MARGIN_PRESETS } from './chunk-5Y34Q4DR.js';
2
+ import { readTextFile, colorEnabled, painter, asciiTerminal, box, marks, paint, stringifyStable, SCHEMA_VERSIONS, processHost, MERGE_DIR, isShardFileName, RunSession, collapseIssues, issueBox, mergeOutcomeLine, parseShardFile, worseStatus } from './chunk-JS7SBYOF.js';
3
+ import { INIT_COMMAND, CONFIG_FILE_EXTENSIONS, CONFIG_FILE_BASENAME, isMergeMode, readInitEnv, PACKAGE_NAME, REPOSITORY_URL, peerDependencies, parsePasses, writeModeState, DOCS_CONFIG_URL, generateRunId, mergeIgnoredEnv, version } from './chunk-ZEQ2IGDC.js';
4
+ import { DEFAULT_CONFIG, resolveConfig, MARGIN_PRESETS } from './chunk-Q73KMM6D.js';
5
5
  import { createInterface } from 'readline/promises';
6
6
  import { spawn } from 'child_process';
7
7
  import { readFileSync } from 'fs';
@@ -1391,6 +1391,15 @@ function stripJsonc(text) {
1391
1391
  }
1392
1392
  return out.replace(/,(\s*[}\]])/gu, "$1");
1393
1393
  }
1394
+ function tsconfigAllowsTsExtensions(text) {
1395
+ if (text === void 0) return false;
1396
+ try {
1397
+ const json = JSON.parse(stripJsonc(text));
1398
+ return json?.compilerOptions?.allowImportingTsExtensions === true;
1399
+ } catch {
1400
+ return false;
1401
+ }
1402
+ }
1394
1403
  function tsconfigAliases(text) {
1395
1404
  if (text === void 0) return [];
1396
1405
  let json;
@@ -1554,6 +1563,12 @@ var CONFIG_OPTIONS = [
1554
1563
  leaf: true,
1555
1564
  default: ["2xx", "3xx"]
1556
1565
  },
1566
+ {
1567
+ path: "measure.coldSamples",
1568
+ description: "The first N timed samples of every key in each pass are cold (first call after the start of the application, which webServer starts again in every pass): they stay out of the evaluated time statistics when at least checks.time.median.minSamples warm samples are left.",
1569
+ leaf: true,
1570
+ default: 1
1571
+ },
1557
1572
  {
1558
1573
  path: "measure.steps",
1559
1574
  description: "Durations of test.step steps as keys of kind 'step'.",
@@ -1644,6 +1659,12 @@ var CONFIG_OPTIONS = [
1644
1659
  leaf: true,
1645
1660
  default: []
1646
1661
  },
1662
+ {
1663
+ path: "keys.operations",
1664
+ description: "Endpoints that get a key per operation, such as POST /graphql#GetTickets instead of one POST /graphql for every GraphQL call.",
1665
+ leaf: true,
1666
+ default: []
1667
+ },
1647
1668
  {
1648
1669
  path: "keys.keyBuilder",
1649
1670
  description: "Builds the endpoint key of a request yourself.",
@@ -2052,6 +2073,52 @@ var CONFIG_OPTIONS = [
2052
2073
  leaf: true,
2053
2074
  default: 0.05
2054
2075
  },
2076
+ {
2077
+ path: "checks.nonSuccess",
2078
+ description: "Share of responses outside measure.successStatuses (e.g. fast 401s) must not exceed the limit; lower Wilson bound compared.",
2079
+ leaf: false
2080
+ },
2081
+ { path: "checks.nonSuccess.enabled", description: "Run this rule.", leaf: true, default: true },
2082
+ {
2083
+ path: "checks.nonSuccess.minSamples",
2084
+ description: "Minimum samples for the rule to run.",
2085
+ leaf: true,
2086
+ default: 5
2087
+ },
2088
+ {
2089
+ path: "checks.nonSuccess.limit",
2090
+ description: "Limit for keys without an entry in the thresholds file.",
2091
+ leaf: false
2092
+ },
2093
+ {
2094
+ path: "checks.nonSuccess.limit.api",
2095
+ description: "Endpoint keys: maximum share of responses outside measure.successStatuses, or null.",
2096
+ leaf: true,
2097
+ default: null
2098
+ },
2099
+ {
2100
+ path: "checks.nonSuccess.margin",
2101
+ description: "Headroom added to the source run value when deriving this limit.",
2102
+ leaf: false
2103
+ },
2104
+ {
2105
+ path: "checks.nonSuccess.margin.factor",
2106
+ description: "Multiplier of the source non-success rate.",
2107
+ leaf: true,
2108
+ default: 1.5
2109
+ },
2110
+ {
2111
+ path: "checks.nonSuccess.margin.add",
2112
+ description: "Added after multiplying.",
2113
+ leaf: true,
2114
+ default: 0.02
2115
+ },
2116
+ {
2117
+ path: "checks.nonSuccess.margin.min",
2118
+ description: "Minimum derived limit.",
2119
+ leaf: true,
2120
+ default: 0.05
2121
+ },
2055
2122
  { path: "gate", description: "Gate policy: when violations fail the run.", leaf: false },
2056
2123
  {
2057
2124
  path: "gate.tolerance",
@@ -2131,6 +2198,17 @@ var CONFIG_OPTIONS = [
2131
2198
  leaf: true,
2132
2199
  default: 0.5
2133
2200
  },
2201
+ {
2202
+ path: "thresholds.workloadShift",
2203
+ description: "Warning THRESHOLDS_WORKLOAD_SHIFT when a key gets a different number of samples per pass than in the thresholds run.",
2204
+ leaf: false
2205
+ },
2206
+ {
2207
+ path: "thresholds.workloadShift.factor",
2208
+ description: "Warn when samples per pass change by this factor or more in either direction; null turns the warning off.",
2209
+ leaf: true,
2210
+ default: 2
2211
+ },
2134
2212
  { path: "report", description: "Run outputs.", leaf: false },
2135
2213
  {
2136
2214
  path: "report.dir",
@@ -2545,10 +2623,10 @@ function addImports(text, lines2) {
2545
2623
  }
2546
2624
 
2547
2625
  // src/cli/init/patterns.ts
2548
- function perfConfigRef(file, text) {
2626
+ function perfConfigRef(file, text, tsExtensions = false) {
2549
2627
  if (/\.[cm]?ts$/u.test(file)) {
2550
2628
  const base = `./${file.replace(/\.[cm]?ts$/u, "")}`;
2551
- return { import: base, require: `require('${base}').default` };
2629
+ return { import: tsExtensions ? `./${file}` : base, require: `require('${base}').default` };
2552
2630
  }
2553
2631
  const cjs = file.endsWith(".cjs") || file.endsWith(".js") && /\bmodule\.exports\b/u.test(text ?? "");
2554
2632
  const path = `./${file}`;
@@ -2632,9 +2710,9 @@ function swapTestImport(text) {
2632
2710
  ...cjs.map((m2) => ({ m: m2, list: items(m2, 2), quote: m2[3], semi: m2[4] ?? "" }))
2633
2711
  ].filter((x) => x.list.some((item) => isName(item, "test")));
2634
2712
  if (matches.length !== 1) return null;
2635
- const { m, list, quote, semi } = matches[0];
2636
- const moved = list.filter((item) => isName(item, "test") || isName(item, "expect"));
2637
- const kept = list.filter((item) => !moved.includes(item));
2713
+ const { m, list: list2, quote, semi } = matches[0];
2714
+ const moved = list2.filter((item) => isName(item, "test") || isName(item, "expect"));
2715
+ const kept = list2.filter((item) => !moved.includes(item));
2638
2716
  const isEsm = esm.includes(m);
2639
2717
  const pkg = `${quote}${PACKAGE_NAME}/test${quote}`;
2640
2718
  const statement = (names, from) => isEsm ? `import { ${names.join(", ")} } from ${from}${semi}` : `${m[1]} { ${names.join(", ")} } = require(${from})${semi}`;
@@ -2653,9 +2731,12 @@ function perfConfigFile(info) {
2653
2731
  }
2654
2732
  function perfConfigReference(info, answers) {
2655
2733
  const existing2 = info.existing.perfConfig;
2656
- if (existing2 !== null) return perfConfigRef(existing2, info.files.get(existing2) ?? null);
2734
+ const tsExtensions = tsconfigAllowsTsExtensions(info.files.get("tsconfig.json"));
2735
+ if (existing2 !== null) {
2736
+ return perfConfigRef(existing2, info.files.get(existing2) ?? null, tsExtensions);
2737
+ }
2657
2738
  const file = perfConfigFile(info);
2658
- return perfConfigRef(file.path, renderPerfConfig(answers, file.format));
2739
+ return perfConfigRef(file.path, renderPerfConfig(answers, file.format), tsExtensions);
2659
2740
  }
2660
2741
  function manual(message, hint) {
2661
2742
  return { code: "INIT_MANUAL_STEP", message, hint };
@@ -3160,9 +3241,9 @@ function importantBox(input, opts) {
3160
3241
  }
3161
3242
 
3162
3243
  // src/cli/init/wizard.ts
3163
- function versionAtLeast(version, minimum) {
3244
+ function versionAtLeast(version2, minimum) {
3164
3245
  const parts = (v) => v.split(/[.+-]/u).slice(0, 3).map((p) => Number.parseInt(p, 10) || 0);
3165
- const a = parts(version);
3246
+ const a = parts(version2);
3166
3247
  const b = parts(minimum);
3167
3248
  for (let i = 0; i < 3; i += 1) {
3168
3249
  if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) > (b[i] ?? 0);
@@ -3777,6 +3858,7 @@ async function main(argv, host) {
3777
3858
  host.stdout.write(helpText());
3778
3859
  return 3;
3779
3860
  }
3861
+ if (isMergeMode(host.env)) return await host.runMerge();
3780
3862
  const env = readInitEnv(host.env, LANGUAGES);
3781
3863
  if (!env.ok) {
3782
3864
  host.stderr.write(formatIssues(env.issues, "error", color(host)));
@@ -3818,7 +3900,7 @@ function minimumPlaywright() {
3818
3900
  const range = peerDependencies["@playwright/test"];
3819
3901
  return /\d+\.\d+\.\d+/u.exec(range)?.[0] ?? "0.0.0";
3820
3902
  }
3821
- function nodeHost() {
3903
+ function nodeHost(runMerge2) {
3822
3904
  return {
3823
3905
  cwd: process.cwd(),
3824
3906
  paths: { join, resolve, dirname },
@@ -3859,9 +3941,292 @@ function nodeHost() {
3859
3941
  },
3860
3942
  makeTempDir: (prefix) => mkdtemp(join(tmpdir(), prefix)),
3861
3943
  removeDir: (path) => rm(path, { recursive: true, force: true }),
3862
- createPrompt: () => readlinePrompt(process.stdin, process.stdout)
3944
+ createPrompt: () => readlinePrompt(process.stdin, process.stdout),
3945
+ runMerge: runMerge2
3946
+ };
3947
+ }
3948
+
3949
+ // src/reporter/merge.ts
3950
+ var EQUAL_FIELDS = [
3951
+ "toolVersion",
3952
+ "playwrightVersion",
3953
+ "mode",
3954
+ "env",
3955
+ "total",
3956
+ "config",
3957
+ "normalization",
3958
+ "stepNormalization",
3959
+ "paths"
3960
+ ];
3961
+ function fieldValue(file, field) {
3962
+ return stringifyStable(field === "total" ? file.shard.total : file[field]);
3963
+ }
3964
+ var FIELD_NAMES = {
3965
+ toolVersion: "package version",
3966
+ playwrightVersion: "Playwright version",
3967
+ mode: "mode",
3968
+ env: "environment label",
3969
+ total: "number of shards",
3970
+ config: "package config",
3971
+ normalization: "normalization",
3972
+ stepNormalization: "step normalization",
3973
+ paths: "paths"
3974
+ };
3975
+ function list(items) {
3976
+ return items.map(String).join(", ");
3977
+ }
3978
+ function validateShardSet(input) {
3979
+ const named = input.files.filter((f) => isShardFileName(f.name));
3980
+ if (named.length === 0) {
3981
+ return {
3982
+ kind: "none",
3983
+ toolErrors: [
3984
+ {
3985
+ code: "MERGE_NO_SHARD_FILES",
3986
+ message: `No shard files (shard-<i>-of-<n>.json) were found in ${MERGE_DIR}/.`,
3987
+ hint: `Download the shard-*.json files of all shard jobs to ${MERGE_DIR}/ and run the merge from the directory where the shards ran the test command.`
3988
+ }
3989
+ ]
3990
+ };
3991
+ }
3992
+ const toolErrors = [];
3993
+ const warnings = [];
3994
+ const valid = [];
3995
+ for (const { name, text } of [...named].sort((a, b) => a.name < b.name ? -1 : 1)) {
3996
+ const parsed = text === null ? { ok: false, reason: "the file could not be read" } : parseShardFile(text);
3997
+ if (!parsed.ok) {
3998
+ toolErrors.push({
3999
+ code: "MERGE_SHARD_INVALID",
4000
+ message: `${name} was skipped: ${parsed.reason}.`,
4001
+ hint: "Use the shard files written by the shard jobs of this run, unchanged."
4002
+ });
4003
+ continue;
4004
+ }
4005
+ valid.push({ name, file: parsed.value });
4006
+ }
4007
+ if (valid.length === 0) return { kind: "fatal", mode: null, status: "failed", toolErrors };
4008
+ valid.sort((a, b) => a.file.shard.current - b.file.shard.current || (a.name < b.name ? -1 : 1));
4009
+ const first = valid[0];
4010
+ const mode = first.file.mode;
4011
+ const status = valid.reduce(
4012
+ (worst, v) => worseStatus(worst, v.file.status),
4013
+ "passed"
4014
+ );
4015
+ for (const field of EQUAL_FIELDS) {
4016
+ const groups = /* @__PURE__ */ new Map();
4017
+ for (const { name, file } of valid) {
4018
+ const value = fieldValue(file, field);
4019
+ groups.set(value, [...groups.get(value) ?? [], name]);
4020
+ }
4021
+ if (groups.size > 1) {
4022
+ const parts = [...groups.values()].map((names) => list(names));
4023
+ toolErrors.push({
4024
+ code: "MERGE_SHARD_MISMATCH",
4025
+ message: `The shard files differ in the ${FIELD_NAMES[field]} (${field}): ${parts.join(" vs ")}.`,
4026
+ hint: "Merge the shard files of one run: the same package version, mode, config and number of shards on every machine."
4027
+ });
4028
+ return { kind: "fatal", mode, status, toolErrors };
4029
+ }
4030
+ }
4031
+ const byIndex = /* @__PURE__ */ new Map();
4032
+ for (const { name, file } of valid) {
4033
+ byIndex.set(file.shard.current, [...byIndex.get(file.shard.current) ?? [], name]);
4034
+ }
4035
+ const duplicates = [...byIndex].filter(([, names]) => names.length > 1);
4036
+ if (duplicates.length > 0) {
4037
+ for (const [index, names] of duplicates) {
4038
+ toolErrors.push({
4039
+ code: "MERGE_SHARD_DUPLICATE",
4040
+ message: `Shard ${String(index)} has more than one file: ${list(names)}.`,
4041
+ hint: `Keep one file per shard in ${MERGE_DIR}/; remove the files of earlier runs.`
4042
+ });
4043
+ }
4044
+ return { kind: "fatal", mode, status, toolErrors };
4045
+ }
4046
+ if (!input.configFound(first.file.paths)) {
4047
+ const { configDir, configFile } = first.file.paths;
4048
+ toolErrors.push({
4049
+ code: "MERGE_WRONG_DIRECTORY",
4050
+ message: `The Playwright config of the shards (${configDir === "." ? "" : `${configDir}/`}${configFile}) is not below the working directory.`,
4051
+ hint: "Run the merge from the directory where the shards ran the test command (in CI: the root of the checkout)."
4052
+ });
4053
+ return { kind: "fatal", mode, status, toolErrors };
4054
+ }
4055
+ const shards = valid.map((v) => v.file);
4056
+ const total = first.file.shard.total;
4057
+ const missing = Array.from({ length: total }, (_, i) => i + 1).filter((n) => !byIndex.has(n));
4058
+ if (missing.length > 0) {
4059
+ toolErrors.push({
4060
+ code: "MERGE_SHARD_MISSING",
4061
+ message: `${missing.length === 1 ? "Shard" : "Shards"} ${missing.map((n) => `${String(n)}/${String(total)}`).join(", ")} ${missing.length === 1 ? "is" : "are"} missing; the report covers the other shards only.`,
4062
+ hint: `Check the shard jobs; every shard must upload ${MERGE_DIR}/shard-*.json, also when it failed.`
4063
+ });
4064
+ }
4065
+ const commits = new Set(shards.flatMap((s) => s.ci?.commit == null ? [] : [s.ci.commit]));
4066
+ if (commits.size > 1) {
4067
+ warnings.push({
4068
+ code: "MERGE_SHARDS_DIFFERENT_COMMIT",
4069
+ message: `The shards ran on ${String(commits.size)} different commits: ${list([...commits].map((c) => c.slice(0, 7)).sort())}.`,
4070
+ hint: "Merge the shard files of one pipeline run; shards of different commits measure different code."
4071
+ });
4072
+ }
4073
+ const hosts = new Set(
4074
+ shards.map((s) => {
4075
+ const { nodeVersion: _, ...host } = s.host;
4076
+ return stringifyStable(host);
4077
+ })
4078
+ );
4079
+ if (hosts.size > 1) {
4080
+ warnings.push({
4081
+ code: "MERGE_SHARDS_DIFFERENT_HOSTS",
4082
+ message: `The shards ran on ${String(hosts.size)} different kinds of machines; differences between machines add noise to the statistics.`,
4083
+ hint: "Run all shards on the same machine type, and derive the thresholds with the same number of shards and machine type as the measurement."
4084
+ });
4085
+ }
4086
+ const ignored = mergeIgnoredEnv(input.env);
4087
+ const differs = [];
4088
+ if (ignored.env !== void 0 && ignored.env !== (first.file.env ?? void 0)) {
4089
+ differs.push(`PW_PERF_ENV=${ignored.env}`);
4090
+ }
4091
+ if (ignored.prune !== void 0 && ignored.prune === "1" !== first.file.prune) {
4092
+ differs.push(`PW_PERF_PRUNE=${ignored.prune}`);
4093
+ }
4094
+ if (ignored.passes !== void 0 && ignored.passes !== String(first.file.passes.planned)) {
4095
+ differs.push(`PW_PERF_PASSES=${ignored.passes}`);
4096
+ }
4097
+ if (differs.length > 0) {
4098
+ warnings.push({
4099
+ code: "MERGE_ENV_IGNORED",
4100
+ message: `${differs.join(", ")} ${differs.length === 1 ? "was" : "were"} ignored: the merge uses the values of the shard files.`,
4101
+ hint: "Set these variables for the test command of the shard jobs, not for the merge job."
4102
+ });
4103
+ }
4104
+ return { kind: "ok", shards, total, missing, warnings, toolErrors };
4105
+ }
4106
+ function internalError2(error) {
4107
+ return {
4108
+ code: "MERGE_INTERNAL_ERROR",
4109
+ message: `Unexpected error in the merge: ${error instanceof Error ? error.stack ?? error.message : String(error)}`,
4110
+ hint: "This is a bug in the package; please report it with the message above."
3863
4111
  };
3864
4112
  }
4113
+ function mergeSettings(first, packageVersion) {
4114
+ const resolved = resolveConfig(first.config, { source: "snapshot" });
4115
+ if (!resolved.ok) {
4116
+ throw new Error(
4117
+ `the config snapshot of the shard files is not valid: ${resolved.issues.map((i) => i.message).join("; ")}`
4118
+ );
4119
+ }
4120
+ return {
4121
+ config: resolved.value.config,
4122
+ // Byte for byte the snapshot of the shards (02-REQ-17).
4123
+ snapshot: first.config,
4124
+ mode: {
4125
+ mode: first.mode,
4126
+ ...first.env === null ? {} : { env: first.env },
4127
+ ...first.prune ? { prune: true } : {}
4128
+ },
4129
+ packageVersion,
4130
+ measuredProjects: first.projects.measured,
4131
+ runConditions: { overridden: [], removedReporters: [], replacedReporters: [] },
4132
+ registered: false,
4133
+ warnings: [],
4134
+ toolErrors: []
4135
+ };
4136
+ }
4137
+ async function runMerge(host, packageVersion) {
4138
+ const io = host.io;
4139
+ const dir = io.resolvePath(host.cwd, MERGE_DIR);
4140
+ const outcomePath = io.resolvePath(dir, "outcome.json");
4141
+ const out = host.stdout;
4142
+ const frame = {
4143
+ width: out.isTTY === true && out.columns !== void 0 && out.columns > 0 ? out.columns : 120,
4144
+ color: colorEnabled(out, host.env),
4145
+ ascii: asciiTerminal(host.env)
4146
+ };
4147
+ let mode = null;
4148
+ let status = "failed";
4149
+ try {
4150
+ try {
4151
+ io.removeFileSync(outcomePath);
4152
+ } catch {
4153
+ }
4154
+ const files = await Promise.all(
4155
+ io.listDirSync(dir).filter(isShardFileName).map(async (name) => {
4156
+ let text;
4157
+ try {
4158
+ text = await io.readTextFile(io.resolvePath(dir, name));
4159
+ } catch {
4160
+ text = null;
4161
+ }
4162
+ return { name, text };
4163
+ })
4164
+ );
4165
+ const set = validateShardSet({
4166
+ files,
4167
+ env: host.env,
4168
+ configFound: (paths) => {
4169
+ const configDir = io.resolvePath(host.cwd, paths.configDir);
4170
+ if (!io.isDirectorySync(configDir)) return false;
4171
+ return paths.configFile === "" || io.listDirSync(configDir).includes(paths.configFile);
4172
+ }
4173
+ });
4174
+ if (set.kind !== "ok") {
4175
+ if (set.kind === "fatal") {
4176
+ mode = set.mode;
4177
+ status = set.status;
4178
+ }
4179
+ return await fail(set.toolErrors);
4180
+ }
4181
+ const first = set.shards[0];
4182
+ mode = first.mode;
4183
+ const input = {
4184
+ shards: set.shards,
4185
+ total: set.total,
4186
+ missing: set.missing,
4187
+ configDir: io.resolvePath(host.cwd, first.paths.configDir),
4188
+ warnings: set.warnings,
4189
+ toolErrors: set.toolErrors
4190
+ };
4191
+ const session = new RunSession(host, mergeSettings(first, packageVersion));
4192
+ return await session.merge(input);
4193
+ } catch (error) {
4194
+ return await fail([internalError2(error)]);
4195
+ }
4196
+ async function fail(toolErrors) {
4197
+ const issues = collapseIssues(toolErrors);
4198
+ host.stderr.write(`${issueBox("error", issues, Infinity, frame).join("\n")}
4199
+ `);
4200
+ if (mode === null) {
4201
+ host.stdout.write(`Outcome: merge not started (code 3)
4202
+ `);
4203
+ return 3;
4204
+ }
4205
+ const outcome = {
4206
+ schemaVersion: SCHEMA_VERSIONS.outcome,
4207
+ runId: generateRunId(host.now(), host.random),
4208
+ mode,
4209
+ exitCode: 3,
4210
+ tests: { status },
4211
+ evaluation: { status: "error", gateEnabled: mode === "test" },
4212
+ toolErrors: issues,
4213
+ paths: { reportJson: null, reportHtml: null, thresholds: [], thresholdsDiff: null }
4214
+ };
4215
+ try {
4216
+ await io.writeJsonStable(outcomePath, outcome);
4217
+ host.stdout.write(mergeOutcomeLine(outcome, outcomePath));
4218
+ } catch (error) {
4219
+ host.stderr.write(
4220
+ `${PACKAGE_NAME}: OUTCOME_WRITE_FAILED: the outcome file could not be written to ${outcomePath}: ${error instanceof Error ? error.message : String(error)}
4221
+ `
4222
+ );
4223
+ }
4224
+ return 3;
4225
+ }
4226
+ }
3865
4227
 
3866
4228
  // src/entries/cli.ts
3867
- process.exitCode = await main(process.argv.slice(2), nodeHost());
4229
+ process.exitCode = await main(
4230
+ process.argv.slice(2),
4231
+ nodeHost(() => runMerge(processHost(), version))
4232
+ );
package/dist/config.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var chunkVREOANPX_cjs = require('./chunk-VREOANPX.cjs');
4
- var chunkW7NEFS5V_cjs = require('./chunk-W7NEFS5V.cjs');
3
+ var chunkVXGTC6DB_cjs = require('./chunk-VXGTC6DB.cjs');
4
+ var chunkVYODYUEL_cjs = require('./chunk-VYODYUEL.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 = `${chunkVREOANPX_cjs.PACKAGE_NAME}/reporter`;
23
+ var PACKAGE_REPORTER = `${chunkVXGTC6DB_cjs.PACKAGE_NAME}/reporter`;
24
24
  function projectName(project) {
25
25
  return project.name ?? "";
26
26
  }
@@ -170,21 +170,21 @@ function planPerfRun(config, input) {
170
170
 
171
171
  // src/config/with-perf.ts
172
172
  function withPerf(config, perfConfig) {
173
- const first = chunkVREOANPX_cjs.readModeState(process.env);
174
- if (!first.ok) throw new chunkVREOANPX_cjs.ConfigError(first.issues);
173
+ const first = chunkVXGTC6DB_cjs.readModeState(process.env);
174
+ if (!first.ok) throw new chunkVXGTC6DB_cjs.ConfigError(first.issues);
175
175
  if (first.value === null) return config;
176
176
  const argvIssues = mainProcessSetup(first.value.mode);
177
- const mode = chunkVREOANPX_cjs.readModeState(process.env);
177
+ const mode = chunkVXGTC6DB_cjs.readModeState(process.env);
178
178
  if (!mode.ok || mode.value === null) throw new Error("withPerf: the mode state changed");
179
179
  const state = mode.value;
180
- const resolved = chunkW7NEFS5V_cjs.resolveConfig(perfConfig, {
180
+ const resolved = chunkVYODYUEL_cjs.resolveConfig(perfConfig, {
181
181
  mode: state.mode === "check" ? "test" : state.mode,
182
182
  ...passesOverride(state),
183
183
  ...state.env === void 0 ? {} : { env: state.env },
184
184
  ...state.thresholdsDir === void 0 ? {} : { thresholdsDir: state.thresholdsDir },
185
185
  ...state.minSamples === void 0 ? {} : { minSamples: state.minSamples }
186
186
  });
187
- if (!resolved.ok) throw new chunkVREOANPX_cjs.ConfigError(resolved.issues);
187
+ if (!resolved.ok) throw new chunkVXGTC6DB_cjs.ConfigError(resolved.issues);
188
188
  const { config: perf, snapshot, warnings } = resolved.value;
189
189
  const plan = planPerfRun(config, {
190
190
  keepReporters: perf.run.keepReporters,
@@ -192,11 +192,11 @@ function withPerf(config, perfConfig) {
192
192
  overrideSlowMo: perf.run.overrideSlowMo,
193
193
  reporterPath: reporterEntryPath()
194
194
  });
195
- chunkVREOANPX_cjs.setRegistered({
195
+ chunkVXGTC6DB_cjs.setRegistered({
196
196
  config: perf,
197
197
  snapshot,
198
198
  mode: state,
199
- packageVersion: chunkVREOANPX_cjs.version,
199
+ packageVersion: chunkVXGTC6DB_cjs.version,
200
200
  measuredProjects: plan.value.measuredProjects,
201
201
  runConditions: plan.value.runConditions,
202
202
  warnings: [...warnings, ...argvIssues],
@@ -215,16 +215,16 @@ function mainProcessSetup(mode) {
215
215
  const store = globalThis;
216
216
  const done = store[SETUP_DONE];
217
217
  if (done !== void 0) return done;
218
- if ((process.env[chunkVREOANPX_cjs.RUN_ID_ENV] ?? "") === "") {
219
- process.env[chunkVREOANPX_cjs.RUN_ID_ENV] = chunkVREOANPX_cjs.generateRunId(/* @__PURE__ */ new Date(), Math.random);
218
+ if ((process.env[chunkVXGTC6DB_cjs.RUN_ID_ENV] ?? "") === "") {
219
+ process.env[chunkVXGTC6DB_cjs.RUN_ID_ENV] = chunkVXGTC6DB_cjs.generateRunId(/* @__PURE__ */ new Date(), Math.random);
220
220
  }
221
- const found = chunkVREOANPX_cjs.argvWarnings(process.argv, chunkVREOANPX_cjs.PACKAGE_NAME, mode);
222
- if (found.reporter !== null && mode !== "check") throw new chunkVREOANPX_cjs.ConfigError([found.reporter]);
221
+ const found = chunkVXGTC6DB_cjs.argvWarnings(process.argv, chunkVXGTC6DB_cjs.PACKAGE_NAME, mode);
222
+ if (found.reporter !== null && mode !== "check") throw new chunkVXGTC6DB_cjs.ConfigError([found.reporter]);
223
223
  const report = [];
224
224
  for (const issue of [found.reporter, found.unsupported]) {
225
225
  if (issue === null) continue;
226
226
  process.stderr.write(
227
- `${chunkVREOANPX_cjs.PACKAGE_NAME}: warning ${issue.code}: ${issue.message}
227
+ `${chunkVXGTC6DB_cjs.PACKAGE_NAME}: warning ${issue.code}: ${issue.message}
228
228
  Hint: ${issue.hint}
229
229
  `
230
230
  );
@@ -236,6 +236,6 @@ function mainProcessSetup(mode) {
236
236
 
237
237
  Object.defineProperty(exports, "definePerfConfig", {
238
238
  enumerable: true,
239
- get: function () { return chunkW7NEFS5V_cjs.definePerfConfig; }
239
+ get: function () { return chunkVYODYUEL_cjs.definePerfConfig; }
240
240
  });
241
241
  exports.withPerf = withPerf;
package/dist/config.js CHANGED
@@ -1,7 +1,6 @@
1
- import { setRegistered } from './chunk-S6UH6QPK.js';
2
- import { readModeState, ConfigError, version, RUN_ID_ENV, generateRunId, argvWarnings, PACKAGE_NAME } from './chunk-YKBX6SAT.js';
3
- import { resolveConfig } from './chunk-5Y34Q4DR.js';
4
- export { definePerfConfig } from './chunk-5Y34Q4DR.js';
1
+ import { readModeState, ConfigError, setRegistered, version, RUN_ID_ENV, generateRunId, argvWarnings, PACKAGE_NAME } from './chunk-ZEQ2IGDC.js';
2
+ import { resolveConfig } from './chunk-Q73KMM6D.js';
3
+ export { definePerfConfig } from './chunk-Q73KMM6D.js';
5
4
 
6
5
  // src/config/reporter-path.ts
7
6
  function currentFile() {
package/dist/fixture.cjs CHANGED
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
 
3
- var chunkPWK5XSP2_cjs = require('./chunk-PWK5XSP2.cjs');
4
- require('./chunk-VREOANPX.cjs');
5
- require('./chunk-W7NEFS5V.cjs');
3
+ var chunkVBNIFMNE_cjs = require('./chunk-VBNIFMNE.cjs');
4
+ require('./chunk-VXGTC6DB.cjs');
5
+ require('./chunk-VYODYUEL.cjs');
6
6
 
7
7
 
8
8
 
9
9
  Object.defineProperty(exports, "trackContext", {
10
10
  enumerable: true,
11
- get: function () { return chunkPWK5XSP2_cjs.trackContext; }
11
+ get: function () { return chunkVBNIFMNE_cjs.trackContext; }
12
12
  });
13
13
  Object.defineProperty(exports, "trackRequestContext", {
14
14
  enumerable: true,
15
- get: function () { return chunkPWK5XSP2_cjs.trackRequestContext; }
15
+ get: function () { return chunkVBNIFMNE_cjs.trackRequestContext; }
16
16
  });
17
17
  Object.defineProperty(exports, "withPerfFixtures", {
18
18
  enumerable: true,
19
- get: function () { return chunkPWK5XSP2_cjs.withPerfFixtures; }
19
+ get: function () { return chunkVBNIFMNE_cjs.withPerfFixtures; }
20
20
  });
package/dist/fixture.js CHANGED
@@ -1,4 +1,3 @@
1
- export { trackContext, trackRequestContext, withPerfFixtures } from './chunk-4WX3Z5MJ.js';
2
- import './chunk-S6UH6QPK.js';
3
- import './chunk-YKBX6SAT.js';
4
- import './chunk-5Y34Q4DR.js';
1
+ export { trackContext, trackRequestContext, withPerfFixtures } from './chunk-PTQWKPHU.js';
2
+ import './chunk-ZEQ2IGDC.js';
3
+ import './chunk-Q73KMM6D.js';
package/dist/index.cjs CHANGED
@@ -1,14 +1,14 @@
1
1
  'use strict';
2
2
 
3
- var chunkW7NEFS5V_cjs = require('./chunk-W7NEFS5V.cjs');
3
+ var chunkVYODYUEL_cjs = require('./chunk-VYODYUEL.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "definePerfConfig", {
8
8
  enumerable: true,
9
- get: function () { return chunkW7NEFS5V_cjs.definePerfConfig; }
9
+ get: function () { return chunkVYODYUEL_cjs.definePerfConfig; }
10
10
  });
11
11
  Object.defineProperty(exports, "perfDefaults", {
12
12
  enumerable: true,
13
- get: function () { return chunkW7NEFS5V_cjs.perfDefaults; }
13
+ get: function () { return chunkVYODYUEL_cjs.perfDefaults; }
14
14
  });