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/dist/reporter.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getRegistered, notWrappedWarning } from './chunk-DYLCGMI2.js';
|
|
2
|
-
import { relativeSlashPath, directoryOf, resolvePath, writeTextAtomic, writeJsonStable, thresholdsFilePaths, loadThresholds, readHostInfo, readCiInfo, Aggregator, parseSampleBatch, schemaIssueToIssue, addKeyedRequest, assessRun, evaluate, formatThresholdsDiff, buildOutcome, renderHtmlReport, stringifyStable, deriveThresholds, diffThresholds, formatThresholdsDiffMarkdown, SCHEMA_VERSIONS, hashHex, isFailedTest, resultId, testIdentity, compareText, plural, padEnd, padStart, textWidth, truncateMiddle, roundMs } from './chunk-
|
|
3
|
-
import { version, readModeState, generateRunId, PACKAGE_NAME, SAMPLES_ATTACHMENT_NAME, CLI_COMMAND } from './chunk-
|
|
4
|
-
import { resolveConfig } from './chunk-
|
|
2
|
+
import { relativeSlashPath, directoryOf, resolvePath, writeTextAtomic, writeJsonStable, thresholdsFilePaths, loadThresholds, readHostInfo, readCiInfo, Aggregator, parseSampleBatch, schemaIssueToIssue, addKeyedRequest, colorEnabled, assessRun, evaluate, formatThresholdsDiff, buildOutcome, renderHtmlReport, stringifyStable, deriveThresholds, diffThresholds, formatThresholdsDiffMarkdown, SCHEMA_VERSIONS, hashHex, isFailedTest, resultId, testIdentity, painter, compareText, plural, padEnd, padStart, textWidth, truncateMiddle, roundMs } from './chunk-3CLCMD2Q.js';
|
|
3
|
+
import { version, readModeState, generateRunId, PACKAGE_NAME, SAMPLES_ATTACHMENT_NAME, CLI_COMMAND } from './chunk-HBGADXLP.js';
|
|
4
|
+
import { resolveConfig } from './chunk-L5C63HEF.js';
|
|
5
5
|
|
|
6
6
|
// src/core/normalize/constants.ts
|
|
7
7
|
var NORMALIZE_RULES_VERSION = 1;
|
|
@@ -155,7 +155,7 @@ function normalizeQuery(params, keys, matchId) {
|
|
|
155
155
|
}
|
|
156
156
|
function truncateKey(key) {
|
|
157
157
|
if (key.length <= MAX_KEY_LENGTH) return key;
|
|
158
|
-
const suffix =
|
|
158
|
+
const suffix = `…~${hashHex(key)}`;
|
|
159
159
|
let cut = MAX_KEY_LENGTH - suffix.length;
|
|
160
160
|
const before = key.charCodeAt(cut - 1);
|
|
161
161
|
const after = key.charCodeAt(cut);
|
|
@@ -389,8 +389,6 @@ var TIME_RULES = /* @__PURE__ */ new Set([
|
|
|
389
389
|
"percentile",
|
|
390
390
|
"p99"
|
|
391
391
|
]);
|
|
392
|
-
var ANSI = { red: "\x1B[31m", yellow: "\x1B[33m", green: "\x1B[32m", bold: "\x1B[1m" };
|
|
393
|
-
var RESET = "\x1B[0m";
|
|
394
392
|
function exceedance(check) {
|
|
395
393
|
if (check.rule === "apdex") return check.actual === 0 ? Infinity : check.limit / check.actual;
|
|
396
394
|
return check.limit === 0 ? Infinity : check.actual / check.limit;
|
|
@@ -434,18 +432,18 @@ function header(report) {
|
|
|
434
432
|
const commit = ci.commit === null ? "" : `@${ci.commit.slice(0, 7)}`;
|
|
435
433
|
parts.push(`${ci.branch ?? ""}${commit}`);
|
|
436
434
|
}
|
|
437
|
-
return parts.join("
|
|
435
|
+
return parts.join(" · ");
|
|
438
436
|
}
|
|
439
437
|
function issueLines(title, issues, limit, marker, more) {
|
|
440
438
|
if (issues.length === 0) return [];
|
|
441
439
|
const lines = [title];
|
|
442
440
|
for (const issue of issues.slice(0, limit)) {
|
|
443
|
-
const times = issue.count !== void 0 && issue.count > 1 ? ` (
|
|
441
|
+
const times = issue.count !== void 0 && issue.count > 1 ? ` (×${issue.count})` : "";
|
|
444
442
|
lines.push(` ${marker} ${issue.code}: ${issue.message}${times}`);
|
|
445
443
|
if (issue.hint !== void 0) lines.push(` Hint: ${issue.hint}`);
|
|
446
444
|
}
|
|
447
445
|
if (issues.length > limit) {
|
|
448
|
-
lines.push(`
|
|
446
|
+
lines.push(` … and ${issues.length - limit} more ${more} (see report)`);
|
|
449
447
|
}
|
|
450
448
|
return [...lines, ""];
|
|
451
449
|
}
|
|
@@ -478,7 +476,7 @@ function counterLines(report) {
|
|
|
478
476
|
const label2 = c.label === "keys" && value === 1 ? "key" : c.label;
|
|
479
477
|
return [`${padStart(String(value), widths[i] ?? 0)} ${label2}`];
|
|
480
478
|
});
|
|
481
|
-
return label + cells.join("
|
|
479
|
+
return label + cells.join(" · ");
|
|
482
480
|
});
|
|
483
481
|
}
|
|
484
482
|
function mutedLines(report) {
|
|
@@ -489,7 +487,7 @@ function mutedLines(report) {
|
|
|
489
487
|
const muted = aggregates[key]?.evaluation.muted;
|
|
490
488
|
if (muted === void 0 || muted === null || muted.expired) continue;
|
|
491
489
|
const label = lines.length === 0 ? "Muted:" : "";
|
|
492
|
-
lines.push(`${padEnd(label, LABEL_WIDTH)}${key} until ${muted.until}
|
|
490
|
+
lines.push(`${padEnd(label, LABEL_WIDTH)}${key} until ${muted.until} — "${muted.note}"`);
|
|
493
491
|
}
|
|
494
492
|
}
|
|
495
493
|
return lines;
|
|
@@ -509,7 +507,7 @@ function tableLines(report, list2, width, paint) {
|
|
|
509
507
|
const level = report.config.checks?.time?.percentile?.level ?? "percentile";
|
|
510
508
|
const shown = list2.slice(0, MAX_VIOLATION_ROWS);
|
|
511
509
|
const rows = shown.map((v) => ({
|
|
512
|
-
marker: v.check.blocking ? "
|
|
510
|
+
marker: v.check.blocking ? "✖" : "!",
|
|
513
511
|
kind: v.kind,
|
|
514
512
|
key: v.key,
|
|
515
513
|
rule: v.check.rule === "percentile" ? level : v.check.rule,
|
|
@@ -547,7 +545,7 @@ function tableLines(report, list2, width, paint) {
|
|
|
547
545
|
const fixed = 4 + widths.kind + widths.rule + widths.actual + widths.limit + widths.over + widths.n + widths.src + widths.flag + 2 * 8;
|
|
548
546
|
const keyWidth = Math.max(MIN_KEY_WIDTH, Math.min(width - fixed, w("key")));
|
|
549
547
|
const line = (r, isHead) => {
|
|
550
|
-
const marker = isHead || r.marker === " " ? r.marker : paint(r.marker, r.marker === "
|
|
548
|
+
const marker = isHead || r.marker === " " ? r.marker : paint(r.marker, r.marker === "✖" ? "red" : "yellow");
|
|
551
549
|
const flag = r.flag.includes("HARD") && !isHead ? paint(r.flag, "red") : r.flag;
|
|
552
550
|
return [
|
|
553
551
|
` ${marker} ${padEnd(r.kind, widths.kind)}`,
|
|
@@ -563,7 +561,7 @@ function tableLines(report, list2, width, paint) {
|
|
|
563
561
|
};
|
|
564
562
|
const lines = [line(head, true), ...rows.map((r) => line(r, false))];
|
|
565
563
|
if (list2.length > shown.length) {
|
|
566
|
-
lines.push(`
|
|
564
|
+
lines.push(` … and ${list2.length - shown.length} more violations (see report)`);
|
|
567
565
|
}
|
|
568
566
|
return lines;
|
|
569
567
|
}
|
|
@@ -580,7 +578,7 @@ function slowestLines(report, list2) {
|
|
|
580
578
|
if (slowest === void 0) continue;
|
|
581
579
|
const t = slowest.test;
|
|
582
580
|
lines.push(
|
|
583
|
-
` slowest: ${v.key}
|
|
581
|
+
` slowest: ${v.key} — ${formatTime(slowest.duration)} in "${t.title}" (${t.file}:${t.line})`
|
|
584
582
|
);
|
|
585
583
|
}
|
|
586
584
|
return lines;
|
|
@@ -654,13 +652,13 @@ function reportLine(report, cwd, html) {
|
|
|
654
652
|
const dir = resolvePath2(report.configDir, options.dir);
|
|
655
653
|
const withHtml = html ?? options.html !== false;
|
|
656
654
|
const files = [...withHtml ? ["report.html"] : [], "report.json"];
|
|
657
|
-
return [`Report: ${files.map((f) => relativePath(cwd, `${dir}/${f}`)).join("
|
|
655
|
+
return [`Report: ${files.map((f) => relativePath(cwd, `${dir}/${f}`)).join(" · ")}`];
|
|
658
656
|
}
|
|
659
657
|
function formatSummary(report, opts) {
|
|
660
|
-
const paint = (
|
|
658
|
+
const paint = painter(opts.color);
|
|
661
659
|
const list2 = violations(report);
|
|
662
660
|
const lines = [header(report), ""];
|
|
663
|
-
lines.push(...issueLines("Errors:", report.toolErrors, Infinity, paint("
|
|
661
|
+
lines.push(...issueLines("Errors:", report.toolErrors, Infinity, paint("✖", "red"), "errors"));
|
|
664
662
|
lines.push(
|
|
665
663
|
...issueLines("Warnings:", report.warnings, MAX_WARNINGS, paint("!", "yellow"), "warnings")
|
|
666
664
|
);
|
|
@@ -761,7 +759,7 @@ function executionsLine(mode, tests, measured, repeat, workers) {
|
|
|
761
759
|
const unique = inMeasured.filter((t) => t.repeatEachIndex === 0).length;
|
|
762
760
|
const others = tests.length - inMeasured.length;
|
|
763
761
|
const extra = others > 0 ? `, plus ${plural2(others, "setup or teardown execution")}` : "";
|
|
764
|
-
return `perf mode "${mode}": ${plural2(inMeasured.length, "test execution")} (${plural2(unique, "test")}
|
|
762
|
+
return `perf mode "${mode}": ${plural2(inMeasured.length, "test execution")} (${plural2(unique, "test")} × ${plural2(repeat, "repeat")}), ${plural2(workers, "worker")}${extra}.`;
|
|
765
763
|
}
|
|
766
764
|
|
|
767
765
|
// src/reporter/samples.ts
|
|
@@ -770,7 +768,7 @@ function testTitle(test) {
|
|
|
770
768
|
for (let suite = test.parent; suite?.type === "describe"; suite = suite.parent) {
|
|
771
769
|
titles.unshift(suite.title);
|
|
772
770
|
}
|
|
773
|
-
return titles.join("
|
|
771
|
+
return titles.join(" › ");
|
|
774
772
|
}
|
|
775
773
|
function projectName(test) {
|
|
776
774
|
return test.parent.project()?.name ?? "";
|
|
@@ -1083,10 +1081,9 @@ var RunSession = class {
|
|
|
1083
1081
|
}
|
|
1084
1082
|
terminal() {
|
|
1085
1083
|
const out = this.host.stdout;
|
|
1086
|
-
const noColor = (this.host.env.NO_COLOR ?? "") !== "";
|
|
1087
1084
|
return {
|
|
1088
1085
|
width: out.isTTY === true && out.columns !== void 0 && out.columns > 0 ? out.columns : DEFAULT_WIDTH,
|
|
1089
|
-
color: out.
|
|
1086
|
+
color: colorEnabled(out, this.host.env)
|
|
1090
1087
|
};
|
|
1091
1088
|
}
|
|
1092
1089
|
/**
|
package/dist/test.cjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var chunkWZVQK7CQ_cjs = require('./chunk-WZVQK7CQ.cjs');
|
|
4
|
+
require('./chunk-4SFI55HF.cjs');
|
|
5
5
|
require('./chunk-GCA73FFP.cjs');
|
|
6
6
|
var test$1 = require('@playwright/test');
|
|
7
7
|
|
|
8
|
-
var test =
|
|
8
|
+
var test = chunkWZVQK7CQ_cjs.withPerfFixtures(test$1.test);
|
|
9
9
|
|
|
10
10
|
Object.defineProperty(exports, "expect", {
|
|
11
11
|
enumerable: true,
|
package/dist/test.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { withPerfFixtures } from './chunk-
|
|
1
|
+
import { withPerfFixtures } from './chunk-B64P2D5A.js';
|
|
2
2
|
import './chunk-DYLCGMI2.js';
|
|
3
|
-
import './chunk-
|
|
4
|
-
import './chunk-
|
|
3
|
+
import './chunk-HBGADXLP.js';
|
|
4
|
+
import './chunk-L5C63HEF.js';
|
|
5
5
|
import { test as test$1 } from '@playwright/test';
|
|
6
6
|
export { expect } from '@playwright/test';
|
|
7
7
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "playwright-performance-regression",
|
|
3
|
-
"version": "0.1.0-next.
|
|
3
|
+
"version": "0.1.0-next.1",
|
|
4
4
|
"description": "Catch backend performance regressions from the Playwright tests you already have.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"playwright",
|
|
@@ -84,8 +84,8 @@
|
|
|
84
84
|
"module": "./dist/index.js",
|
|
85
85
|
"types": "./dist/index.d.cts",
|
|
86
86
|
"bin": {
|
|
87
|
-
"playwright-performance-regression": "
|
|
88
|
-
"pw-perf": "
|
|
87
|
+
"playwright-performance-regression": "dist/cli.js",
|
|
88
|
+
"pw-perf": "dist/cli.js"
|
|
89
89
|
},
|
|
90
90
|
"files": [
|
|
91
91
|
"dist",
|