playwright-performance-regression 0.1.0-next.0 → 0.1.0-next.1
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 +18 -0
- package/README.md +3 -1
- package/dist/{chunk-JEHUFIY3.js → chunk-3CLCMD2Q.js} +45 -24
- package/dist/{chunk-LV3O2BAT.cjs → chunk-4SFI55HF.cjs} +1 -1
- package/dist/{chunk-UTTU4FUC.js → chunk-B64P2D5A.js} +2 -2
- package/dist/{chunk-6AB42SPF.js → chunk-HBGADXLP.js} +6 -6
- package/dist/{chunk-HES6BVZT.js → chunk-L5C63HEF.js} +2 -2
- package/dist/{chunk-R2NPYGB7.cjs → chunk-WZVQK7CQ.cjs} +14 -14
- package/dist/cli.js +1177 -253
- package/dist/config.cjs +9 -9
- package/dist/config.js +3 -3
- package/dist/fixture.cjs +4 -4
- package/dist/fixture.js +3 -3
- package/dist/index.js +1 -1
- package/dist/reporter.cjs +84 -66
- package/dist/reporter.js +19 -22
- package/dist/test.cjs +3 -3
- package/dist/test.js +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.0-next.1] - 2026-11-19
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `init` asks first whether to set the package up with a guided tutorial; no (or
|
|
15
|
+
`--no-tutorial`) prints the manual setup steps and changes nothing.
|
|
16
|
+
- `init` speaks English, Spanish, French, Polish, Italian, Ukrainian and Russian: chosen in the
|
|
17
|
+
first step or with `--lang <code>`. Codes, file names and the written files stay English.
|
|
18
|
+
- Colors in the terminal for `init` (step headers, questions, diffs, summary) and the CLI
|
|
19
|
+
messages, run summary and thresholds diff, with `NO_COLOR`, `FORCE_COLOR` and `TERM=dumb`.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
|
|
23
|
+
- The `init` hint and the docs show Playwright's tag option `{ tag: '@perf' }` for tagging tests.
|
|
24
|
+
- `bin` paths in both packages no longer start with `./`, so npm stops warning that it
|
|
25
|
+
corrected them when publishing.
|
|
26
|
+
- README: `yarn create` with a version (such as `@next`) needs Yarn 2 or later.
|
|
27
|
+
|
|
10
28
|
## [0.1.0-next.0] - 2026-11-19
|
|
11
29
|
|
|
12
30
|
### Added
|
package/README.md
CHANGED
|
@@ -32,7 +32,9 @@ This installs the package as a dev dependency and starts a short guided setup (`
|
|
|
32
32
|
shows a diff of every change before writing anything: it wraps your Playwright config, wraps your
|
|
33
33
|
`test` object or switches test imports, creates `pw-perf.config.ts`, adds `perf:test` and
|
|
34
34
|
`perf:thresholds` scripts, ignores `perf-results/`, and can add a CI job. `pnpm create` and
|
|
35
|
-
`yarn create` work too;
|
|
35
|
+
`yarn create` work too (Yarn 2 or later; Yarn 1 cannot install a specific version such as
|
|
36
|
+
`@next` with `yarn create`); `-- --yes` accepts the defaults without questions. The guided
|
|
37
|
+
setup speaks English, Spanish, French, Polish, Italian, Ukrainian and Russian (`--lang <code>`).
|
|
36
38
|
|
|
37
39
|
<details>
|
|
38
40
|
<summary>Manual setup</summary>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CONTEXT_CLOSED_FAILURE_TEXT, PACKAGE_NAME, CLI_COMMAND, DIFF_CATEGORIES, diffCountsText, LISTED_CATEGORIES, diffValuesText, diffMarker, REPOSITORY_URL, LIMIT_NAMES, diffChangeText } from './chunk-
|
|
2
|
-
import { str, nullable, constant, obj, bool, msOrNull, epochMs, enumOf, oneOf, int, nul, num, arr, issue, isoDate, ratio, msLimit, fingerprint, hostFingerprint, derivationSettings, percentileName, count, timestamp, runId, envLabelOrNull, tool, kind, record, key, anyObject, ms, packageConfig, mode, evaluationStatus, testsStatus, isRecord, Sink, child } from './chunk-
|
|
1
|
+
import { CONTEXT_CLOSED_FAILURE_TEXT, PACKAGE_NAME, CLI_COMMAND, DIFF_CATEGORIES, diffCountsText, LISTED_CATEGORIES, diffValuesText, diffMarker, REPOSITORY_URL, LIMIT_NAMES, diffChangeText } from './chunk-HBGADXLP.js';
|
|
2
|
+
import { str, nullable, constant, obj, bool, msOrNull, epochMs, enumOf, oneOf, int, nul, num, arr, issue, isoDate, ratio, msLimit, fingerprint, hostFingerprint, derivationSettings, percentileName, count, timestamp, runId, envLabelOrNull, tool, kind, record, key, anyObject, ms, packageConfig, mode, evaluationStatus, testsStatus, isRecord, Sink, child } from './chunk-L5C63HEF.js';
|
|
3
3
|
import { readFile, access, mkdir, writeFile, rename, rm } from 'fs/promises';
|
|
4
4
|
import { resolve, dirname, relative, isAbsolute, join, basename } from 'path';
|
|
5
5
|
import { randomUUID } from 'crypto';
|
|
@@ -704,11 +704,11 @@ var HINTS = {
|
|
|
704
704
|
SCHEMA_VERSION_TOO_NEW: "The file was written by a newer version of the package; update the package to read it.",
|
|
705
705
|
SCHEMA_VERSION_MISMATCH: "The attachment was written by another version of the package; use one package version in a run.",
|
|
706
706
|
SCHEMA_VALIDATION_FAILED: "Fix the listed fields; the JSON Schemas in the package's schemas/ directory describe the format.",
|
|
707
|
-
THRESHOLDS_KIND_MISMATCH: 'Each kind has its own file (perf-thresholds.api
|
|
707
|
+
THRESHOLDS_KIND_MISMATCH: 'Each kind has its own file (perf-thresholds.api… and perf-thresholds.custom…); move the entries to the right file or fix "kind".'
|
|
708
708
|
};
|
|
709
709
|
function describeProblems(problems, more) {
|
|
710
710
|
const list = problems.map((p) => `${p.pointer === "" ? "(root)" : p.pointer} ${p.message}`).join("; ");
|
|
711
|
-
return more ? `${list};
|
|
711
|
+
return more ? `${list}; …` : list;
|
|
712
712
|
}
|
|
713
713
|
function issueOf(code2, source, summary, problems = []) {
|
|
714
714
|
const shown = problems.slice(0, MAX_PROBLEMS).map(({ pointer, message }) => ({ pointer, message }));
|
|
@@ -985,7 +985,7 @@ function formatDate(iso) {
|
|
|
985
985
|
}
|
|
986
986
|
function formatRunDuration(startedAt, finishedAt) {
|
|
987
987
|
const ms2 = Date.parse(finishedAt) - Date.parse(startedAt);
|
|
988
|
-
if (!Number.isFinite(ms2) || ms2 < 0) return "
|
|
988
|
+
if (!Number.isFinite(ms2) || ms2 < 0) return "—";
|
|
989
989
|
const total = Math.round(ms2 / 1e3);
|
|
990
990
|
const h = Math.floor(total / 3600);
|
|
991
991
|
const min = Math.floor(total % 3600 / 60);
|
|
@@ -1002,7 +1002,7 @@ function truncateMiddle(text, max) {
|
|
|
1002
1002
|
if (points.length <= max) return text;
|
|
1003
1003
|
const keep = max - 1;
|
|
1004
1004
|
const head = Math.ceil(keep / 2);
|
|
1005
|
-
return `${points.slice(0, head).join("")}
|
|
1005
|
+
return `${points.slice(0, head).join("")}…${points.slice(points.length - (keep - head)).join("")}`;
|
|
1006
1006
|
}
|
|
1007
1007
|
|
|
1008
1008
|
// src/html/bar.ts
|
|
@@ -1131,7 +1131,7 @@ function embeddedJson(data) {
|
|
|
1131
1131
|
}
|
|
1132
1132
|
|
|
1133
1133
|
// src/html/generated/assets.ts
|
|
1134
|
-
var STYLES = ':root{color-scheme:light dark;--bg: #ffffff;--fg: #1b1f24;--muted: #57606a;--border: #d0d7de;--panel: #f6f8fa;--ok: #116329;--warn: #7d4e00;--bad: #b3261e;--link: #0550ae;--mark: #1b1f24;--range: #9fb4cc}@media(prefers-color-scheme:dark){:root{--bg: #0d1117;--fg: #e6edf3;--muted: #9da7b3;--border: #3d444d;--panel: #161b22;--ok: #56d364;--warn: #e3b341;--bad: #ff8e88;--link: #79c0ff;--mark: #e6edf3;--range: #3b5070}}*{box-sizing:border-box}html{background:var(--bg);color:var(--fg);font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}body{margin:0;overflow-x:hidden}main,footer{max-width:1280px;margin:0 auto;padding:0 16px}h1{margin:0 0 12px;font-size:24px}h2{margin:32px 0 12px;font-size:19px;border-bottom:1px solid var(--border);padding-bottom:4px}h2.sub{border:0;font-size:15px;margin:16px 0 4px}h3{margin:0 0 4px;font-size:15px}h4{margin:12px 0 4px;font-size:14px}p{margin:4px 0}a{color:var(--link)}code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px}pre{background:var(--panel);border:1px solid var(--border);padding:12px;overflow-x:auto}.page-header{padding-top:24px}.tool,.muted-text,.limit,.hint{color:var(--muted)}.meta{display:flex;flex-wrap:wrap;gap:4px 24px;margin:0}.meta dt{color:var(--muted);font-size:12px}.meta dd{margin:0;overflow-wrap:anywhere}.origins,.plain{margin:0;padding-left:20px}.ok{color:var(--ok)}.warn{color:var(--warn)}.bad{color:var(--bad)}.verdict{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.card{border:1px solid var(--border);border-left-width:6px;border-radius:6px;padding:12px;background:var(--panel);color:var(--fg)}.card.ok{border-left-color:var(--ok)}.card.warn{border-left-color:var(--warn)}.card.bad{border-left-color:var(--bad)}.card .status{font-size:18px;font-weight:700;text-transform:uppercase}.card.ok .status{color:var(--ok)}.card.warn .status{color:var(--warn)}.card.bad .status{color:var(--bad)}.note{font-style:italic}.toolbar{margin-top:12px}.issues{list-style:none;padding:0;margin:0}.issues li{border-left:4px solid currentColor;padding:4px 12px;margin:8px 0}.issues li p{color:var(--fg)}.issues li p.hint{color:var(--muted)}.highlight{border:2px solid var(--bad);border-radius:6px;padding:0 12px 12px}.scroll{overflow-x:auto;max-width:100%}table{border-collapse:collapse;width:100%;margin:4px 0 12px}caption{text-align:left;color:var(--muted);padding:4px 0}th,td{border-bottom:1px solid var(--border);padding:4px 8px;text-align:left;vertical-align:top}thead th{background:var(--panel);white-space:nowrap}th[scope=row]{font-weight:400}.num{text-align:right;white-space:nowrap}table.keys th.key{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;white-space:nowrap}th button{font:inherit;font-weight:700;color:inherit;background:none;border:0;padding:0;cursor:default}.js th button{cursor:pointer;text-decoration:underline dotted}.js th[aria-sort=ascending] button:after{content:"
|
|
1134
|
+
var STYLES = ':root{color-scheme:light dark;--bg: #ffffff;--fg: #1b1f24;--muted: #57606a;--border: #d0d7de;--panel: #f6f8fa;--ok: #116329;--warn: #7d4e00;--bad: #b3261e;--link: #0550ae;--mark: #1b1f24;--range: #9fb4cc}@media(prefers-color-scheme:dark){:root{--bg: #0d1117;--fg: #e6edf3;--muted: #9da7b3;--border: #3d444d;--panel: #161b22;--ok: #56d364;--warn: #e3b341;--bad: #ff8e88;--link: #79c0ff;--mark: #e6edf3;--range: #3b5070}}*{box-sizing:border-box}html{background:var(--bg);color:var(--fg);font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,sans-serif}body{margin:0;overflow-x:hidden}main,footer{max-width:1280px;margin:0 auto;padding:0 16px}h1{margin:0 0 12px;font-size:24px}h2{margin:32px 0 12px;font-size:19px;border-bottom:1px solid var(--border);padding-bottom:4px}h2.sub{border:0;font-size:15px;margin:16px 0 4px}h3{margin:0 0 4px;font-size:15px}h4{margin:12px 0 4px;font-size:14px}p{margin:4px 0}a{color:var(--link)}code,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px}pre{background:var(--panel);border:1px solid var(--border);padding:12px;overflow-x:auto}.page-header{padding-top:24px}.tool,.muted-text,.limit,.hint{color:var(--muted)}.meta{display:flex;flex-wrap:wrap;gap:4px 24px;margin:0}.meta dt{color:var(--muted);font-size:12px}.meta dd{margin:0;overflow-wrap:anywhere}.origins,.plain{margin:0;padding-left:20px}.ok{color:var(--ok)}.warn{color:var(--warn)}.bad{color:var(--bad)}.verdict{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:12px}.card{border:1px solid var(--border);border-left-width:6px;border-radius:6px;padding:12px;background:var(--panel);color:var(--fg)}.card.ok{border-left-color:var(--ok)}.card.warn{border-left-color:var(--warn)}.card.bad{border-left-color:var(--bad)}.card .status{font-size:18px;font-weight:700;text-transform:uppercase}.card.ok .status{color:var(--ok)}.card.warn .status{color:var(--warn)}.card.bad .status{color:var(--bad)}.note{font-style:italic}.toolbar{margin-top:12px}.issues{list-style:none;padding:0;margin:0}.issues li{border-left:4px solid currentColor;padding:4px 12px;margin:8px 0}.issues li p{color:var(--fg)}.issues li p.hint{color:var(--muted)}.highlight{border:2px solid var(--bad);border-radius:6px;padding:0 12px 12px}.scroll{overflow-x:auto;max-width:100%}table{border-collapse:collapse;width:100%;margin:4px 0 12px}caption{text-align:left;color:var(--muted);padding:4px 0}th,td{border-bottom:1px solid var(--border);padding:4px 8px;text-align:left;vertical-align:top}thead th{background:var(--panel);white-space:nowrap}th[scope=row]{font-weight:400}.num{text-align:right;white-space:nowrap}table.keys th.key{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;white-space:nowrap}th button{font:inherit;font-weight:700;color:inherit;background:none;border:0;padding:0;cursor:default}.js th button{cursor:pointer;text-decoration:underline dotted}.js th[aria-sort=ascending] button:after{content:" ▲"}.js th[aria-sort=descending] button:after{content:" ▼"}table.keys tr:first-child>td:first-of-type{white-space:nowrap}.details-row>td{padding-top:0}details>summary{cursor:pointer;color:var(--link)}.details-body{padding:4px 0 12px;max-width:960px}.full-key code,.url{overflow-wrap:anywhere;word-break:break-all}.facts{display:grid;grid-template-columns:max-content 1fr;gap:2px 16px;margin:8px 0}.facts div{display:contents}.facts dt{color:var(--muted)}.facts dd{margin:0}.slowest,.top-tests{margin:0;padding-left:20px}table.checks{width:auto}.bar{width:100%;max-width:640px;height:auto;display:block;margin:8px 0}.bar text{fill:var(--fg);font-size:11px}.bar .bar-limit-text{fill:var(--bad)}.bar-axis{stroke:var(--muted);stroke-width:1}.bar-range{fill:var(--range)}.bar-mark{stroke:var(--mark);stroke-width:2}.bar-limit{stroke:var(--bad);stroke-width:1.5;stroke-dasharray:4 3}.filters{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin:8px 0}.filters[hidden],[hidden]{display:none!important}input[type=search]{font:inherit;color:var(--fg);background:var(--bg);border:1px solid var(--border);border-radius:4px;padding:2px 6px;margin-left:4px}#download{font:inherit;color:var(--fg);background:var(--panel);border:1px solid var(--border);border-radius:6px;padding:4px 12px;cursor:pointer}button:focus-visible,input:focus-visible,summary:focus-visible,a:focus-visible{outline:2px solid var(--link);outline-offset:2px}.visually-hidden{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}footer{margin:40px auto 24px;color:var(--muted);border-top:1px solid var(--border);padding-top:12px}@media print{:root{color-scheme:light;--bg: #ffffff;--fg: #000000;--muted: #444444;--border: #bbbbbb;--panel: #ffffff;--ok: #0b5e20;--warn: #6a4200;--bad: #a1150e;--link: #000000;--mark: #000000;--range: #c8d3e0}.filters,.toolbar,th button:after{display:none!important}.scroll{overflow:visible}tbody,tr{break-inside:avoid}details[data-violation]::details-content{content-visibility:visible;display:block}}';
|
|
1135
1135
|
var STYLES_SHA256 = "rMj6c+jgU9bq6OVZSVVT3M4IvsOeXLSFzdizre4Z7Bc=";
|
|
1136
1136
|
var SCRIPT = `(()=>{const D=document.getElementById("report-data"),b=D?.textContent??'{"endpoints":{},"custom":{}}',C=JSON.parse(b);document.documentElement.classList.add("js");function H(e,a,d,f){if(e===void 0)return null;switch(a){case"result":return f;case"samples":return e.successCount;case"errors":return e.errorCount;case"p50":return e.stats?.percentiles.p50??null;case"percentile":return e.stats?.percentiles[d]??null;case"p99":return e.stats?.percentiles.p99??null;case"max":return e.stats?.max??null;case"ttfb":return e.ttfb?.p50??null;case"tests":return e.testCount;default:return null}}function T(e,a){return e<a?-1:e>a?1:0}function M(e){const a=e.dataset.kind==="custom"?"custom":"endpoints",d=e.dataset.percentile??"p95",f=C[a],m=Array.from(e.tBodies),v=Array.from(e.querySelectorAll("th[data-sort]"));let u=null;function w(r,o){const s=o==="ascending"?1:-1,l=m.map(t=>{const n=t.dataset.key??"",A=Number(t.dataset.group??"3");return{body:t,key:n,value:H(f[n],r,d,A)}});l.sort((t,n)=>{if(r!=="key"){if(t.value===null||n.value===null){if(t.value!==n.value)return t.value===null?1:-1}else if(t.value!==n.value)return(t.value-n.value)*s;return T(t.key,n.key)}return T(t.key,n.key)*s});for(const t of l)e.appendChild(t.body);for(const t of v)t.dataset.sort===r?t.setAttribute("aria-sort",o):t.removeAttribute("aria-sort")}for(const r of v){const o=r.dataset.sort??"key";r.querySelector("button")?.addEventListener("click",()=>{const s=o==="key"||o==="result"?"ascending":"descending",l=u!==null&&u.column===o?u.direction==="ascending"?"descending":"ascending":s;u={column:o,direction:l},w(o,l)})}const c=document.querySelector(\`[data-filters-for="\${e.id}"]\`);if(c===null)return;const g=c.querySelector('[data-filter="text"]'),L=c.querySelector('[data-filter="violations"]'),E=c.querySelector('[data-filter="not-evaluated"]'),k=c.querySelector("[data-count]");function h(){const r=(g?.value??"").toLowerCase();let o=0;for(const s of m){const l=(s.dataset.key??"").toLowerCase(),t=s.dataset.result??"",n=l.includes(r)&&!(L?.checked===!0&&t!=="fail")&&!(E?.checked===!0&&t==="not-evaluated");s.hidden=!n,n&&o++}k!==null&&(k.textContent=\`showing \${o} of \${m.length}\`)}for(const r of[g,L,E])r?.addEventListener("input",h),r?.addEventListener("change",h);c.hidden=!1}for(const e of Array.from(document.querySelectorAll("table.keys")))M(e);const p=document.getElementById("download"),y=document.getElementById("download-link");p instanceof HTMLButtonElement&&y instanceof HTMLAnchorElement&&(p.addEventListener("click",()=>{const e=URL.createObjectURL(new Blob([b],{type:"application/json"}));y.href=e,y.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)}),p.hidden=!1);let i=[];window.addEventListener("beforeprint",()=>{i=Array.from(document.querySelectorAll("details[data-violation]:not([open])"));for(const e of i)e.open=!0});window.addEventListener("afterprint",()=>{for(const e of i)e.open=!1;i=[]});})();`;
|
|
1137
1137
|
var SCRIPT_SHA256 = "NczooZoEwk0CPgfuEFUbnRFp9bbi8jrYYzyk+WNBTEc=";
|
|
@@ -1144,7 +1144,7 @@ var TIME_RULES = /* @__PURE__ */ new Set([
|
|
|
1144
1144
|
"percentile",
|
|
1145
1145
|
"p99"
|
|
1146
1146
|
]);
|
|
1147
|
-
var DASH = "
|
|
1147
|
+
var DASH = "—";
|
|
1148
1148
|
function join2(...parts) {
|
|
1149
1149
|
return html`${parts}`;
|
|
1150
1150
|
}
|
|
@@ -3256,8 +3256,8 @@ function formatThresholdsDiffMarkdown(diffs, paths) {
|
|
|
3256
3256
|
if (listed.length > 0) {
|
|
3257
3257
|
lines.push("", "| | Key | Before | After |", "|---|---|---|---|");
|
|
3258
3258
|
for (const k of listed) {
|
|
3259
|
-
const before = diffValuesText(k, "before", diff.level, "
|
|
3260
|
-
const after = diffValuesText(k, "after", diff.level, "
|
|
3259
|
+
const before = diffValuesText(k, "before", diff.level, " · ");
|
|
3260
|
+
const after = diffValuesText(k, "after", diff.level, " · ");
|
|
3261
3261
|
lines.push(`| ${diffMarker(k)} | ${code(k.key)} | ${cell(before)} | ${cell(after)} |`);
|
|
3262
3262
|
}
|
|
3263
3263
|
}
|
|
@@ -3280,6 +3280,29 @@ function formatThresholdsDiffMarkdown(diffs, paths) {
|
|
|
3280
3280
|
`;
|
|
3281
3281
|
}
|
|
3282
3282
|
|
|
3283
|
+
// src/console/color.ts
|
|
3284
|
+
var ANSI = {
|
|
3285
|
+
green: "\x1B[32m",
|
|
3286
|
+
red: "\x1B[31m",
|
|
3287
|
+
yellow: "\x1B[33m",
|
|
3288
|
+
cyan: "\x1B[36m",
|
|
3289
|
+
dim: "\x1B[2m",
|
|
3290
|
+
bold: "\x1B[1m"
|
|
3291
|
+
};
|
|
3292
|
+
var RESET = "\x1B[0m";
|
|
3293
|
+
function colorEnabled(stream, env) {
|
|
3294
|
+
if ((env.NO_COLOR ?? "") !== "") return false;
|
|
3295
|
+
const force = env.FORCE_COLOR;
|
|
3296
|
+
if (force !== void 0) return force !== "0";
|
|
3297
|
+
return stream.isTTY === true && env.TERM !== "dumb";
|
|
3298
|
+
}
|
|
3299
|
+
function paint(text, style, enabled) {
|
|
3300
|
+
return enabled && text !== "" ? `${ANSI[style]}${text}${RESET}` : text;
|
|
3301
|
+
}
|
|
3302
|
+
function painter(enabled) {
|
|
3303
|
+
return (text, style) => paint(text, style, enabled);
|
|
3304
|
+
}
|
|
3305
|
+
|
|
3283
3306
|
// src/console/text.ts
|
|
3284
3307
|
function compareText4(a, b) {
|
|
3285
3308
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
@@ -3290,10 +3313,10 @@ function plural3(n, word, many = `${word}s`) {
|
|
|
3290
3313
|
function truncateMiddle2(text, width) {
|
|
3291
3314
|
const chars = Array.from(text);
|
|
3292
3315
|
if (chars.length <= width) return text;
|
|
3293
|
-
if (width <= 1) return "
|
|
3316
|
+
if (width <= 1) return "…".slice(0, width);
|
|
3294
3317
|
const head = Math.ceil((width - 1) / 2);
|
|
3295
3318
|
const tail = width - 1 - head;
|
|
3296
|
-
return `${chars.slice(0, head).join("")}
|
|
3319
|
+
return `${chars.slice(0, head).join("")}…${tail === 0 ? "" : chars.slice(-tail).join("")}`;
|
|
3297
3320
|
}
|
|
3298
3321
|
function textWidth(text) {
|
|
3299
3322
|
return Array.from(text).length;
|
|
@@ -3308,16 +3331,14 @@ function padStart(text, width) {
|
|
|
3308
3331
|
// src/console/thresholds-diff.ts
|
|
3309
3332
|
var MAX_DIFF_ROWS = 30;
|
|
3310
3333
|
var MIN_KEY_WIDTH = 30;
|
|
3311
|
-
var ANSI = { red: "\x1B[31m", yellow: "\x1B[33m", green: "\x1B[32m" };
|
|
3312
|
-
var RESET = "\x1B[0m";
|
|
3313
3334
|
var MARKER_STYLE = {
|
|
3314
3335
|
"+": "green",
|
|
3315
3336
|
"-": "red",
|
|
3316
|
-
"
|
|
3317
|
-
"
|
|
3318
|
-
"
|
|
3337
|
+
"↑": "yellow",
|
|
3338
|
+
"↓": "green",
|
|
3339
|
+
"±": "yellow"
|
|
3319
3340
|
};
|
|
3320
|
-
function fileLines(diff, path, opts,
|
|
3341
|
+
function fileLines(diff, path, opts, paint2) {
|
|
3321
3342
|
const lines = [`Thresholds: ${path} (${fileStatusText(diff)})`];
|
|
3322
3343
|
const listed = diff.keys.filter((k) => LISTED_CATEGORIES.has(k.category));
|
|
3323
3344
|
const expired = diff.keys.filter((k) => k.muted?.expired === true);
|
|
@@ -3338,20 +3359,20 @@ function fileLines(diff, path, opts, paint) {
|
|
|
3338
3359
|
for (const r of rows) {
|
|
3339
3360
|
const head = r.marker.slice(0, 1);
|
|
3340
3361
|
const style = MARKER_STYLE[head] ?? "yellow";
|
|
3341
|
-
const marker =
|
|
3362
|
+
const marker = paint2(head, style) + (r.marker.length > 1 ? paint2(r.marker.slice(1), "red") : "");
|
|
3342
3363
|
const pad2 = " ".repeat(markerWidth - textWidth(r.marker));
|
|
3343
3364
|
lines.push(
|
|
3344
3365
|
` ${marker}${pad2} ${padEnd(truncateMiddle2(r.key, keyWidth), keyWidth)} ${r.change}`.trimEnd()
|
|
3345
3366
|
);
|
|
3346
3367
|
}
|
|
3347
3368
|
if (listed.length > shown.length) {
|
|
3348
|
-
lines.push(`
|
|
3369
|
+
lines.push(` … and ${listed.length - shown.length} more`);
|
|
3349
3370
|
}
|
|
3350
3371
|
}
|
|
3351
3372
|
if (expired.length > 0) {
|
|
3352
3373
|
lines.push("");
|
|
3353
3374
|
for (const k of expired) {
|
|
3354
|
-
lines.push(` ${
|
|
3375
|
+
lines.push(` ${paint2("!", "yellow")} ${k.key} muted (expired ${k.muted?.until ?? ""})`);
|
|
3355
3376
|
}
|
|
3356
3377
|
}
|
|
3357
3378
|
const unseen = diff.counts.unseen;
|
|
@@ -3372,10 +3393,10 @@ function mutedSuffix(k) {
|
|
|
3372
3393
|
return k.muted !== void 0 && !k.muted.expired ? ` (muted until ${k.muted.until})` : "";
|
|
3373
3394
|
}
|
|
3374
3395
|
function formatThresholdsDiff(diffs, opts) {
|
|
3375
|
-
const
|
|
3396
|
+
const paint2 = painter(opts.color);
|
|
3376
3397
|
const lines = [];
|
|
3377
3398
|
diffs.forEach((diff, i) => {
|
|
3378
|
-
lines.push(...fileLines(diff, opts.paths[i] ?? `${diff.kind} thresholds`, opts,
|
|
3399
|
+
lines.push(...fileLines(diff, opts.paths[i] ?? `${diff.kind} thresholds`, opts, paint2));
|
|
3379
3400
|
});
|
|
3380
3401
|
const written = diffs.some((d) => d.fileStatus === "created" || d.fileStatus === "updated");
|
|
3381
3402
|
lines.push("");
|
|
@@ -3387,4 +3408,4 @@ function formatThresholdsDiff(diffs, opts) {
|
|
|
3387
3408
|
`;
|
|
3388
3409
|
}
|
|
3389
3410
|
|
|
3390
|
-
export { Aggregator, SCHEMA_VERSIONS, addKeyedRequest, assessRun, buildOutcome, compareText4 as compareText, deriveThresholds, diffThresholds, directoryOf, evaluate, fileExists, formatThresholdsDiff, formatThresholdsDiffMarkdown, hashHex, isFailedTest, loadThresholds, padEnd, padStart, parseOutcome, parseRunReport, parseSampleBatch, plural3 as plural, readCiInfo, readHostInfo, readTextFile, relativeSlashPath, renderHtmlReport, resolvePath, resultId, roundMs, schemaIssueToIssue, stringifyStable, testIdentity, textWidth, thresholdsFilePaths, truncateMiddle2 as truncateMiddle, writeJsonStable, writeTextAtomic };
|
|
3411
|
+
export { Aggregator, SCHEMA_VERSIONS, addKeyedRequest, assessRun, buildOutcome, colorEnabled, compareText4 as compareText, deriveThresholds, diffThresholds, directoryOf, evaluate, fileExists, formatThresholdsDiff, formatThresholdsDiffMarkdown, hashHex, isFailedTest, loadThresholds, padEnd, padStart, paint, painter, parseOutcome, parseRunReport, parseSampleBatch, plural3 as plural, readCiInfo, readHostInfo, readTextFile, relativeSlashPath, renderHtmlReport, resolvePath, resultId, roundMs, schemaIssueToIssue, stringifyStable, testIdentity, textWidth, thresholdsFilePaths, truncateMiddle2 as truncateMiddle, writeJsonStable, writeTextAtomic };
|
|
@@ -291,7 +291,7 @@ function setActiveCollector(collector) {
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
// package.json
|
|
294
|
-
var version = "0.1.0-next.
|
|
294
|
+
var version = "0.1.0-next.1";
|
|
295
295
|
|
|
296
296
|
exports.CLI_COMMAND = CLI_COMMAND;
|
|
297
297
|
exports.CONTEXT_CLOSED_FAILURE_TEXT = CONTEXT_CLOSED_FAILURE_TEXT;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { wrappedTests, trackedContexts, activeCollector, setActiveCollector, getRegistered } from './chunk-DYLCGMI2.js';
|
|
2
|
-
import { readModeState, ConfigError, version, SAMPLES_ATTACHMENT_NAME, CONTEXT_CLOSED_FAILURE_TEXT } from './chunk-
|
|
3
|
-
import { perfDefaults } from './chunk-
|
|
2
|
+
import { readModeState, ConfigError, version, SAMPLES_ATTACHMENT_NAME, CONTEXT_CLOSED_FAILURE_TEXT } from './chunk-HBGADXLP.js';
|
|
3
|
+
import { perfDefaults } from './chunk-L5C63HEF.js';
|
|
4
4
|
|
|
5
5
|
// src/collector/constants.ts
|
|
6
6
|
var KNOWN_THIRD_PARTY_HOSTS = Object.freeze([
|
|
@@ -77,9 +77,9 @@ function limitValueText(limit, value) {
|
|
|
77
77
|
var MARKERS = {
|
|
78
78
|
added: "+",
|
|
79
79
|
removed: "-",
|
|
80
|
-
loosened: "
|
|
81
|
-
tightened: "
|
|
82
|
-
mixed: "
|
|
80
|
+
loosened: "↑",
|
|
81
|
+
tightened: "↓",
|
|
82
|
+
mixed: "±",
|
|
83
83
|
unchanged: "=",
|
|
84
84
|
locked: "#",
|
|
85
85
|
unseen: "?",
|
|
@@ -112,7 +112,7 @@ function diffCountsText(diff) {
|
|
|
112
112
|
}
|
|
113
113
|
parts.push(`${n} ${category}${extra}`);
|
|
114
114
|
}
|
|
115
|
-
return parts.length === 0 ? "no entries" : parts.join("
|
|
115
|
+
return parts.length === 0 ? "no entries" : parts.join(" · ");
|
|
116
116
|
}
|
|
117
117
|
function diffValuesText(diff, side, level, separator) {
|
|
118
118
|
if (diff.limits !== void 0) {
|
|
@@ -130,7 +130,7 @@ function diffChangeText(diff, level, separator) {
|
|
|
130
130
|
return diffValuesText(diff, diff.category === "added" ? "after" : "before", level, separator);
|
|
131
131
|
}
|
|
132
132
|
return diff.changes.map(
|
|
133
|
-
(c) => `${limitLabel(c.limit, level)} ${limitValueText(c.limit, c.before)}
|
|
133
|
+
(c) => `${limitLabel(c.limit, level)} ${limitValueText(c.limit, c.before)} → ${limitValueText(c.limit, c.after)}`
|
|
134
134
|
).join(separator);
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -246,7 +246,7 @@ function isCiEnv(env) {
|
|
|
246
246
|
}
|
|
247
247
|
|
|
248
248
|
// package.json
|
|
249
|
-
var version = "0.1.0-next.
|
|
249
|
+
var version = "0.1.0-next.1";
|
|
250
250
|
var peerDependencies = {
|
|
251
251
|
"@playwright/test": ">=1.57.0"
|
|
252
252
|
};
|
|
@@ -435,7 +435,7 @@ function describeValue(value) {
|
|
|
435
435
|
text = void 0;
|
|
436
436
|
}
|
|
437
437
|
if (text === void 0) return Array.isArray(value) ? "an array" : "an object";
|
|
438
|
-
return text.length > MAX_SHOWN ? `${text.slice(0, MAX_SHOWN - 1)}
|
|
438
|
+
return text.length > MAX_SHOWN ? `${text.slice(0, MAX_SHOWN - 1)}…` : text;
|
|
439
439
|
}
|
|
440
440
|
function editDistance(a, b) {
|
|
441
441
|
let previous = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
@@ -702,7 +702,7 @@ function exampleHint(segments) {
|
|
|
702
702
|
if (Array.isArray(list)) example = list[0];
|
|
703
703
|
}
|
|
704
704
|
const shown = example === void 0 || isRecord(example) ? void 0 : describeValue(example);
|
|
705
|
-
const prefix = shown === void 0 || shown.endsWith("
|
|
705
|
+
const prefix = shown === void 0 || shown.endsWith("…") ? "" : `Default: ${shown}. `;
|
|
706
706
|
return `${prefix}${SCHEMA_FILE} in the package lists every option and its format.`;
|
|
707
707
|
}
|
|
708
708
|
function problemToIssue(problem, document) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk4SFI55HF_cjs = require('./chunk-4SFI55HF.cjs');
|
|
4
4
|
var chunkGCA73FFP_cjs = require('./chunk-GCA73FFP.cjs');
|
|
5
5
|
|
|
6
6
|
// src/collector/constants.ts
|
|
@@ -428,7 +428,7 @@ var RequestTracker = class {
|
|
|
428
428
|
}
|
|
429
429
|
#closedByClient(request, entry) {
|
|
430
430
|
this.#settle(request);
|
|
431
|
-
this.#sink.finished(failed(request, entry,
|
|
431
|
+
this.#sink.finished(failed(request, entry, chunk4SFI55HF_cjs.CONTEXT_CLOSED_FAILURE_TEXT, safeTiming(request)));
|
|
432
432
|
}
|
|
433
433
|
/** A request still in flight after the wait (05-REQ-13 step 4, 05-REQ-31). */
|
|
434
434
|
#leftover(request, entry) {
|
|
@@ -654,10 +654,10 @@ var TestCollector = class {
|
|
|
654
654
|
try {
|
|
655
655
|
await this.drain();
|
|
656
656
|
const body = JSON.stringify(this.batch());
|
|
657
|
-
await testInfo.attach(
|
|
657
|
+
await testInfo.attach(chunk4SFI55HF_cjs.SAMPLES_ATTACHMENT_NAME, { body, contentType: "application/json" });
|
|
658
658
|
} catch (error) {
|
|
659
659
|
process.stderr.write(
|
|
660
|
-
`COLLECTOR_ATTACH_FAILED: ${
|
|
660
|
+
`COLLECTOR_ATTACH_FAILED: ${chunk4SFI55HF_cjs.SAMPLES_ATTACHMENT_NAME} could not be attached to the test result: ${errorText(error)}
|
|
661
661
|
`
|
|
662
662
|
);
|
|
663
663
|
}
|
|
@@ -675,8 +675,8 @@ function engineOf(context) {
|
|
|
675
675
|
var now = () => performance.now();
|
|
676
676
|
var wallNow = () => Date.now();
|
|
677
677
|
function perfModeOn() {
|
|
678
|
-
const mode =
|
|
679
|
-
if (!mode.ok) throw new
|
|
678
|
+
const mode = chunk4SFI55HF_cjs.readModeState(process.env);
|
|
679
|
+
if (!mode.ok) throw new chunk4SFI55HF_cjs.ConfigError(mode.issues);
|
|
680
680
|
return mode.value !== null;
|
|
681
681
|
}
|
|
682
682
|
function passiveApi() {
|
|
@@ -687,19 +687,19 @@ function passiveApi() {
|
|
|
687
687
|
);
|
|
688
688
|
}
|
|
689
689
|
function openBuffer(browserName, testInfo) {
|
|
690
|
-
const state =
|
|
690
|
+
const state = chunk4SFI55HF_cjs.getRegistered();
|
|
691
691
|
if (state !== void 0 && !state.measuredProjects.includes(testInfo.project.name)) {
|
|
692
692
|
return { collector: null, api: passiveApi() };
|
|
693
693
|
}
|
|
694
694
|
const collector = new TestCollector({
|
|
695
695
|
measure: (state?.config ?? chunkGCA73FFP_cjs.perfDefaults).measure,
|
|
696
|
-
version:
|
|
696
|
+
version: chunk4SFI55HF_cjs.version,
|
|
697
697
|
browserName,
|
|
698
698
|
testTimeout: () => testInfo.timeout,
|
|
699
699
|
now,
|
|
700
700
|
wallNow
|
|
701
701
|
});
|
|
702
|
-
for (const context of
|
|
702
|
+
for (const context of chunk4SFI55HF_cjs.trackedContexts()) collector.track(context);
|
|
703
703
|
return { collector, api: collector.api };
|
|
704
704
|
}
|
|
705
705
|
var passiveFixtures = {
|
|
@@ -712,10 +712,10 @@ var perfFixtures = {
|
|
|
712
712
|
async ({ browserName }, use, testInfo) => {
|
|
713
713
|
const buffer = openBuffer(browserName ?? null, testInfo);
|
|
714
714
|
const { collector } = buffer;
|
|
715
|
-
if (collector !== null)
|
|
715
|
+
if (collector !== null) chunk4SFI55HF_cjs.setActiveCollector(collector);
|
|
716
716
|
await use(buffer);
|
|
717
717
|
if (collector === null) return;
|
|
718
|
-
if (
|
|
718
|
+
if (chunk4SFI55HF_cjs.activeCollector() === collector) chunk4SFI55HF_cjs.setActiveCollector(void 0);
|
|
719
719
|
collector.markTeardownStart();
|
|
720
720
|
await collector.attach(testInfo);
|
|
721
721
|
},
|
|
@@ -737,7 +737,7 @@ var perfFixtures = {
|
|
|
737
737
|
}
|
|
738
738
|
};
|
|
739
739
|
function withPerfFixtures(base2) {
|
|
740
|
-
const wrapped =
|
|
740
|
+
const wrapped = chunk4SFI55HF_cjs.wrappedTests();
|
|
741
741
|
if (wrapped.has(base2)) return base2;
|
|
742
742
|
const extend = base2.extend;
|
|
743
743
|
const result = extend.call(base2, perfModeOn() ? perfFixtures : passiveFixtures);
|
|
@@ -746,12 +746,12 @@ function withPerfFixtures(base2) {
|
|
|
746
746
|
}
|
|
747
747
|
function trackContext(context) {
|
|
748
748
|
if (!perfModeOn()) return;
|
|
749
|
-
const contexts =
|
|
749
|
+
const contexts = chunk4SFI55HF_cjs.trackedContexts();
|
|
750
750
|
if (!contexts.has(context)) {
|
|
751
751
|
contexts.add(context);
|
|
752
752
|
context.once("close", () => contexts.delete(context));
|
|
753
753
|
}
|
|
754
|
-
|
|
754
|
+
chunk4SFI55HF_cjs.activeCollector()?.track(context);
|
|
755
755
|
}
|
|
756
756
|
|
|
757
757
|
exports.trackContext = trackContext;
|