@mark1russell7/site-pages 0.8.3 → 0.8.5

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/README.md CHANGED
@@ -139,7 +139,27 @@ The check runs the probe on the first page, in the first scheme, at each width.
139
139
 
140
140
  To probe other pages, give `--page-probe <page>=<file>` one time for each page, for example `--page-probe /structures/=structures-probe.ts`. A page with no probe has none. The first page takes `--probe` or `--page-probe`, not both. In `checkSite`, the option `probes` is the same map, from a page to the code of its probe.
141
141
 
142
- The folder of `--shots` gets a screenshot of each view, `report.json` and `summary.md`. The exit code is 0 when each view passes, 1 when a view fails, and 2 for an incorrect command line.
142
+ To hold the size of the built files, give `--budget <glob>=<size>` one time for each budget, for example `--budget assets/index-*.js=280kB`. The glob starts at the folder of `--out`. Each file of the glob fails the check when its gzip size is larger than the size. A glob with no file also fails, so a new file name does not escape its budget.
143
+
144
+ The unit of a size is `B`, `kB` or `MB`, and a number with no unit is in kB. The option needs `--out`. The log, `report.json` and `summary.md` give the size of each budget.
145
+
146
+ ### Error texts with no error view
147
+
148
+ A page that shows `TypeError: Failed to fetch` gives the user no context, no retry and nothing to copy or report. The check finds each such text that a page shows outside an error view:
149
+
150
+ - The text has the shape of a thrown value (`Error: x`, `TypeError: x`, `DOMException: x`), or a message of the browser (`Failed to fetch`, `Cannot read properties of undefined`, `is not a function`, `[object Object]`).
151
+ - A script starts in each page before its own scripts and watches each text that the page adds or changes. Thus a text that shows for a short time also counts, and so does a text that an action of the probe shows.
152
+ - A text in an error view does not count: `<otel-error>` of `@mark1russell7/otel-ts/error-view`, or an element with `data-error-view`. A text in `pre`, `code`, `kbd`, `samp`, `textarea` or a hidden element does not count either.
153
+
154
+ By default, the check only reports each text, and the view does not fail. The log, `summary.md` and `report.json` (the field `bareErrors` of a view) give the texts. To make each text fail its view, set the field `sitePages.bareErrors` to `"fail"` in the `package.json` of the working folder:
155
+
156
+ ```json
157
+ { "sitePages": { "bareErrors": "fail" } }
158
+ ```
159
+
160
+ The option `--bare-errors fail` or `--bare-errors report` overrides the field. Turn the failure on when the report of the site gives no text.
161
+
162
+ The folder of `--shots` gets a screenshot of each view, `report.json` and `summary.md`. The exit code is 0 when each view and each budget passes. It is 1 when a view or a budget fails, and 2 for an incorrect command line.
143
163
 
144
164
  The check finds a browser in this order: `--browser`, `$SITE_CHECK_BROWSER`, the newest Chromium of Playwright, and then Chrome or Edge. The folder `src/check` imports only Node.js. Thus Node.js 22.18 or later can start `src/check/main.ts` with no install. The workflow `reusable-pages.yml` of the template uses it this way.
145
165
 
package/build/cli.js CHANGED
@@ -3,10 +3,11 @@ import { T as safeUrl, b as escapeHtml, m as runFreshnessCli } from "./chunks/fr
3
3
  import { a as runCli, o as TYPESCRIPT_PROBE, s as probeScript } from "./chunks/build.js";
4
4
  import { t as FALLBACK_HEADER } from "./chunks/offline-header.js";
5
5
  import { spawn } from "node:child_process";
6
- import { appendFileSync, createReadStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
6
+ import { appendFileSync, createReadStream, existsSync, globSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
7
7
  import { delimiter, extname, isAbsolute, join, normalize, relative, resolve, sep } from "node:path";
8
8
  import { parseArgs } from "node:util";
9
9
  import { homedir, tmpdir } from "node:os";
10
+ import { gzipSync } from "node:zlib";
10
11
  import { createServer } from "node:http";
11
12
  // src/bar/bar.ts
12
13
  /**
@@ -760,6 +761,59 @@ ${code}
760
761
  return __checks;
761
762
  })()`;
762
763
  }
764
+ // src/check/budget.ts
765
+ /**
766
+ * The size budgets of `site-pages check`. A budget is a glob of the files of the built site and a limit of the gzip size of each
767
+ * file. A file over its limit fails the check. A budget with no file fails too, so a new file name does not escape its limit.
768
+ * The code reads the files on disk. It needs no browser.
769
+ */
770
+ /**
771
+ * This function reads a budget of the form `<glob>=<size>`, for example `assets/index-*.js=280kB`. The size is a number with
772
+ * the unit `B`, `kB` (1000 bytes) or `MB` (1000000 bytes). A number with no unit is in kB. A bad entry gives an Error.
773
+ */
774
+ function parseBudget(entry) {
775
+ const split = entry.lastIndexOf("=");
776
+ const pattern = entry.slice(0, split).trim();
777
+ const size = /^(\d+(?:\.\d+)?)\s*(B|kB|MB)?$/.exec(entry.slice(split + 1).trim());
778
+ if (split <= 0 || pattern === "" || size === null) return /* @__PURE__ */ new Error(`--budget must be <glob>=<size>, for example assets/*.js=280kB, not "${entry}"`);
779
+ const unit = size[2] === "B" ? 1 : size[2] === "MB" ? 1e6 : 1e3;
780
+ return {
781
+ pattern: pattern.replace(/\\/g, "/").replace(/^\/+/, ""),
782
+ limit: Math.round(Number(size[1]) * unit)
783
+ };
784
+ }
785
+ /** This function gives a size in bytes as text in kB, with one decimal. */
786
+ function kilobytes(bytes) {
787
+ return `${(bytes / 1e3).toFixed(1)} kB`;
788
+ }
789
+ /** This function measures each file of each budget in the site folder `out`, and gives the result of each budget. */
790
+ function checkBudgets(out, budgets) {
791
+ return budgets.map(({ pattern, limit }) => {
792
+ const files = globSync(pattern, { cwd: out }).map((file) => file.replace(/\\/g, "/")).sort().map((file) => {
793
+ const body = readFileSync(join(out, file));
794
+ return {
795
+ file,
796
+ bytes: body.length,
797
+ gzip: gzipSync(body, { level: 9 }).length
798
+ };
799
+ }).sort((a, b) => b.gzip - a.gzip);
800
+ const problems = files.length === 0 ? [`no file of the site matches the budget ${pattern}`] : files.filter((file) => file.gzip > limit).map((file) => `${file.file} is ${kilobytes(file.gzip)} (gzip), over the budget ${pattern} of ${kilobytes(limit)}`);
801
+ return {
802
+ pattern,
803
+ limit,
804
+ files,
805
+ ok: problems.length === 0,
806
+ problems
807
+ };
808
+ });
809
+ }
810
+ /** This function gives the log line of a budget. */
811
+ function budgetLine(result) {
812
+ const largest = result.files[0];
813
+ const size = largest === void 0 ? "no file" : `${kilobytes(largest.gzip)} (gzip) in ${largest.file}`;
814
+ const problems = result.problems.length > 0 ? `\n - ${result.problems.join("\n - ")}` : "";
815
+ return `${result.ok ? "PASS" : "FAIL"} budget ${result.pattern}: ${size}, the limit is ${kilobytes(result.limit)}, ${result.files.length} file(s)${problems}`;
816
+ }
763
817
  // src/check/serve.ts
764
818
  /**
765
819
  * A static file server for the `check` command. It serves a built site folder at the path of the
@@ -854,6 +908,87 @@ async function serve(root, base) {
854
908
  })
855
909
  };
856
910
  }
911
+ // src/check/bare-errors.ts
912
+ /**
913
+ * Bare error texts. A page that shows `TypeError: Failed to fetch` gives the user no context, no retry and nothing to copy or
914
+ * report. An error view gives all of them. This file finds the texts of an error that a page shows outside an error view.
915
+ *
916
+ * A script starts in each page before its own scripts (`BARE_ERROR_WATCH`). It watches each text that the page adds or changes,
917
+ * also a text that shows for a short time only. `BARE_ERRORS` reads what it found. A repository turns the failure on with the
918
+ * field `sitePages.bareErrors` of its package.json, or with `--bare-errors fail`. Until then the check reports the texts only.
919
+ */
920
+ /** The modes, for the CLI and package.json. */
921
+ const BARE_ERROR_MODES = ["fail", "report"];
922
+ /**
923
+ * The shape of the text of a thrown value, for example `Error: x`, `TypeError: x` or `DOMException: x`. It also matches the
924
+ * messages of the browser that a page shows when it puts `error.message` on the screen.
925
+ */
926
+ const BARE_ERROR_SHAPE = String.raw`(?:^|[\s("'\[:])[A-Z]?[A-Za-z]*(?:Error|Exception): \S|Failed to fetch|NetworkError when attempting to fetch|Cannot read propert(?:y|ies) of (?:undefined|null)|is not a function|\[object Object\]|Unexpected token .{1,20} in JSON`;
927
+ /** The elements whose text is an example, not a message: code, and the text of a form field. */
928
+ const BARE_ERROR_SKIP = "pre, code, kbd, samp, textarea, script, style, template, noscript, [hidden], [aria-hidden=true]";
929
+ /** The error views. A text inside one is not bare. */
930
+ const ERROR_VIEWS = "otel-error, [data-error-view]";
931
+ const KEY = "site-check.bare-errors";
932
+ /**
933
+ * A script that each page starts before its own scripts. It records each text with the shape of an error that the page adds or
934
+ * changes outside an error view. It records the element and the text, at most `MAX_BARE_ERRORS` of them.
935
+ */
936
+ const BARE_ERROR_WATCH = `(() => {
937
+ const shape = new RegExp(${JSON.stringify(BARE_ERROR_SHAPE)});
938
+ const skip = ${JSON.stringify(BARE_ERROR_SKIP)};
939
+ const views = ${JSON.stringify(ERROR_VIEWS)};
940
+ const found = [];
941
+ const seen = new Set();
942
+ Object.defineProperty(globalThis, Symbol.for(${JSON.stringify(KEY)}), { value: found });
943
+ const name = (element) => element.tagName.toLowerCase() + (element.id ? "#" + element.id : element.classList.length > 0 ? "." + element.classList[0] : "");
944
+ const look = (node) => {
945
+ const element = node.parentElement;
946
+ if (found.length >= 20 || !element || element.closest(skip) || element.closest(views)) return;
947
+ const texts = [node.data];
948
+ // The text of the element too, for a message in two nodes. Not when it has code in it: that is an example.
949
+ if (!element.querySelector(skip)) texts.push(element.textContent ?? "");
950
+ const text = texts.map((each) => each.replace(/\\s+/g, " ").trim()).find((each) => shape.test(each));
951
+ if (text === undefined) return;
952
+ const entry = name(element) + ': "' + text.slice(0, 160) + '"';
953
+ if (seen.has(entry)) return;
954
+ seen.add(entry);
955
+ found.push(entry);
956
+ };
957
+ const walk = (root) => {
958
+ if (root.nodeType === 3) return look(root);
959
+ if (root.nodeType !== 1) return;
960
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT);
961
+ for (let node = walker.nextNode(); node; node = walker.nextNode()) look(node);
962
+ };
963
+ new MutationObserver((records) => {
964
+ for (const record of records) {
965
+ if (record.type === "characterData") look(record.target);
966
+ else for (const node of record.addedNodes) walk(node);
967
+ }
968
+ }).observe(document, { subtree: true, childList: true, characterData: true });
969
+ })();`;
970
+ /** The expression that gives the texts that `BARE_ERROR_WATCH` found in the page. */
971
+ const BARE_ERRORS = `[...(globalThis[Symbol.for(${JSON.stringify(KEY)})] ?? [])]`;
972
+ /** The problem of one bare error text. */
973
+ function bareErrorProblem(entry) {
974
+ return `an error text with no error view: ${entry}`;
975
+ }
976
+ /**
977
+ * This function reads the mode from the field `sitePages.bareErrors` of the package.json in `cwd`. No file or no field gives
978
+ * `report`. A field with another value gives an Error.
979
+ */
980
+ function readBareErrorMode(cwd) {
981
+ let manifest;
982
+ try {
983
+ manifest = JSON.parse(readFileSync(join(cwd, "package.json"), "utf8"));
984
+ } catch {
985
+ return "report";
986
+ }
987
+ const pages = typeof manifest === "object" && manifest !== null ? manifest.sitePages : void 0;
988
+ const value = typeof pages === "object" && pages !== null ? pages.bareErrors : void 0;
989
+ if (value === void 0) return "report";
990
+ return BARE_ERROR_MODES.includes(value) ? value : /* @__PURE__ */ new Error(`the field sitePages.bareErrors of package.json must be fail or report, not ${JSON.stringify(value)}`);
991
+ }
857
992
  /**
858
993
  * This function gives a page expression that scrolls the page to its end, one screen at a time, and then back to the top.
859
994
  * Thus each part that starts when it comes into view starts before the measure. Examples are an Astro island with
@@ -940,6 +1075,10 @@ async function checkSite(options) {
940
1075
  const probes = pageProbes(options);
941
1076
  if (options.out === void 0 && options.url === void 0) throw new Error("give out or url");
942
1077
  if (options.offline === true && options.out === void 0) throw new Error("the offline check needs out: it stops the server of the folder to cut the network");
1078
+ const budgetList = options.budgets ?? [];
1079
+ if (budgetList.length > 0 && options.out === void 0) throw new Error("a size budget needs out: it reads the files of the folder");
1080
+ const budgets = options.out === void 0 || budgetList.length === 0 ? void 0 : checkBudgets(options.out, budgetList);
1081
+ for (const budget of budgets ?? []) log(budgetLine(budget));
943
1082
  const server = options.out !== void 0 ? await serve(options.out, options.base ?? "/") : void 0;
944
1083
  const views = [];
945
1084
  let homeUrl;
@@ -958,6 +1097,7 @@ async function checkSite(options) {
958
1097
  page.send("Network.enable")
959
1098
  ]);
960
1099
  await page.send("Page.addScriptToEvaluateOnNewDocument", { source: LOAD_WATCH });
1100
+ await page.send("Page.addScriptToEvaluateOnNewDocument", { source: BARE_ERROR_WATCH });
961
1101
  return {
962
1102
  page,
963
1103
  events
@@ -1036,10 +1176,11 @@ async function checkSite(options) {
1036
1176
  await server?.close();
1037
1177
  }
1038
1178
  const result = {
1039
- ok: views.length > 0 && views.every((view) => view.ok),
1179
+ ok: views.length > 0 && views.every((view) => view.ok) && (budgets ?? []).every((budget) => budget.ok),
1040
1180
  url: homeUrl.href,
1041
1181
  browser: executable,
1042
- views
1182
+ views,
1183
+ ...budgets === void 0 ? {} : { budgets }
1043
1184
  };
1044
1185
  if (options.shots) {
1045
1186
  writeFileSync(join(options.shots, "report.json"), `${JSON.stringify(result, null, 2)}\n`);
@@ -1052,7 +1193,12 @@ function viewLine(view) {
1052
1193
  const measure = view.measure ? ` scrollWidth=${view.measure.scrollWidth} innerWidth=${view.measure.innerWidth}` : "";
1053
1194
  const probe = view.probe ? ` probe ${view.probe.filter((c) => c.ok).length}/${view.probe.length}` : "";
1054
1195
  const problems = view.problems.length > 0 ? `\n - ${view.problems.join("\n - ")}` : "";
1055
- return `${view.ok ? "PASS" : "FAIL"}${view.retried ? " (retried)" : ""} ${view.page} ${view.width} ${view.scheme}${view.offline ? " offline" : ""}${measure}${probe}${problems}`;
1196
+ const notes = reportedOnly(view).map((entry) => `\n ~ report only: ${bareErrorProblem(entry)}`).join("");
1197
+ return `${view.ok ? "PASS" : "FAIL"}${view.retried ? " (retried)" : ""} ${view.page} ${view.width} ${view.scheme}${view.offline ? " offline" : ""}${measure}${probe}${problems}${notes}`;
1198
+ }
1199
+ /** The bare error texts of a view that are not problems of the view: the mode is report. */
1200
+ function reportedOnly(view) {
1201
+ return (view.bareErrors ?? []).filter((entry) => !view.problems.includes(bareErrorProblem(entry)));
1056
1202
  }
1057
1203
  /**
1058
1204
  * This function gives a page expression that waits until a service worker of the site controls the page. The expression gives an
@@ -1218,6 +1364,11 @@ async function checkView(page, events, input) {
1218
1364
  if (checks.length === 0) view.problems.push("the probe made no check");
1219
1365
  for (const check of checks.filter((entry) => !entry.ok)) view.problems.push(`probe: ${check.name}${check.detail ? ` (${check.detail})` : ""}`);
1220
1366
  }
1367
+ const bare = await page.evaluate(BARE_ERRORS);
1368
+ if (bare.length > 0) {
1369
+ view.bareErrors = bare;
1370
+ if (options.bareErrors === "fail") view.problems.push(...bare.map(bareErrorProblem));
1371
+ }
1221
1372
  } catch (error) {
1222
1373
  hung = error instanceof NoReplyError;
1223
1374
  view.problems.push(error instanceof Error ? error.message : String(error));
@@ -1245,7 +1396,7 @@ function cell(text) {
1245
1396
  function summary(result) {
1246
1397
  const failed = result.views.filter((view) => !view.ok);
1247
1398
  const retried = result.views.filter((view) => view.ok && view.retried !== void 0);
1248
- return [
1399
+ const lines = [
1249
1400
  `### Site check: ${result.ok ? "passed" : "failed"}`,
1250
1401
  "",
1251
1402
  `${result.views.length - failed.length} of ${result.views.length} views passed, at ${result.url}.` + (retried.length > 0 ? ` ${retried.length} of them passed only on a second try, after the browser did not answer.` : ""),
@@ -1254,7 +1405,16 @@ function summary(result) {
1254
1405
  "| --- | ---: | --- | --- | --- |",
1255
1406
  ...result.views.map((view) => `| \`${view.page}\`${view.offline ? " (offline)" : ""} | ${view.width} | ${view.scheme} | ${view.ok ? "pass" : "**fail**"}${view.retried ? " (retried)" : ""}${view.probe ? ` (probe ${view.probe.filter((c) => c.ok).length}/${view.probe.length})` : ""} | ${view.problems.map(cell).join("<br>")} |`),
1256
1407
  ""
1257
- ].join("\n");
1408
+ ];
1409
+ const reported = result.views.filter((view) => reportedOnly(view).length > 0);
1410
+ if (reported.length > 0) lines.push(`${reported.length} of ${result.views.length} views show an error text with no error view. The check does not fail, because package.json has no field sitePages.bareErrors with the value fail.`, "", ...new Set(reported.flatMap((view) => reportedOnly(view).map((entry) => `- \`${view.page}\`: ${cell(entry)}`))), "");
1411
+ if (result.budgets !== void 0 && result.budgets.length > 0) lines.push("| Size budget | Largest file | Gzip | Limit | Result |", "| --- | --- | ---: | ---: | --- |", ...result.budgets.map((budget) => {
1412
+ const largest = budget.files[0];
1413
+ const file = largest === void 0 ? "none" : `\`${cell(largest.file)}\``;
1414
+ const problems = budget.problems.length > 0 ? `<br>${budget.problems.map(cell).join("<br>")}` : "";
1415
+ return `| \`${cell(budget.pattern)}\` | ${file} | ${largest === void 0 ? "" : kilobytes(largest.gzip)} | ${kilobytes(budget.limit)} | ${budget.ok ? "pass" : "**fail**"}${problems} |`;
1416
+ }), "");
1417
+ return lines.join("\n");
1258
1418
  }
1259
1419
  const CHECK_HELP = `Usage: site-pages check (--out <dir> | --url <url>) [options]
1260
1420
 
@@ -1263,7 +1423,8 @@ the dark scheme, and fails when a page is wider than the screen, an element goes
1263
1423
  edge, a text area hides its text, a box cuts text, a table goes out of view on a phone, a page
1264
1424
  shows no text, or on a console error, an exception, a failed request of the site, a script that
1265
1425
  does not load or a failed check of the probe. Add data-overflow-ok to a box that is meant to
1266
- scroll or to clip.
1426
+ scroll or to clip. It reports each text with the shape of an error, for example "TypeError: Failed
1427
+ to fetch", that a page shows outside an error view (<otel-error> or [data-error-view]).
1267
1428
 
1268
1429
  Options:
1269
1430
  --out <dir> The built site folder. The check serves it at --base.
@@ -1290,6 +1451,14 @@ Options:
1290
1451
  A new browser opens the home page and waits for the service worker of the
1291
1452
  site. Then the check stops the server. A page fails when the worker does not
1292
1453
  answer it. It needs --out.
1454
+ --budget <glob>=<size>
1455
+ A size budget of the files of --out, for example assets/*.js=280kB. A
1456
+ file of the glob fails the check when its gzip size is over the size. A
1457
+ glob with no file fails too. The unit is B, kB or MB (default kB). Give
1458
+ the option one time for each budget. It needs --out.
1459
+ --bare-errors <mode> fail: an error text outside an error view fails the view. report: the
1460
+ check reports it only. Default: the field sitePages.bareErrors of the
1461
+ package.json in the working folder, else report.
1293
1462
  --help Shows this text
1294
1463
 
1295
1464
  With $GITHUB_STEP_SUMMARY, the check adds its table to the job summary.
@@ -1319,6 +1488,11 @@ async function runCheckCli(argv, io) {
1319
1488
  settle: { type: "string" },
1320
1489
  timeout: { type: "string" },
1321
1490
  offline: { type: "boolean" },
1491
+ budget: {
1492
+ type: "string",
1493
+ multiple: true
1494
+ },
1495
+ "bare-errors": { type: "string" },
1322
1496
  help: { type: "boolean" }
1323
1497
  }
1324
1498
  }));
@@ -1340,6 +1514,13 @@ async function runCheckCli(argv, io) {
1340
1514
  const url = text("url");
1341
1515
  if (out === void 0 === (url === void 0)) return usage("give --out or --url, not both");
1342
1516
  if (values["offline"] === true && out === void 0) return usage("--offline needs --out: the check stops the server of the folder to cut the network");
1517
+ const budgets = [];
1518
+ for (const entry of values["budget"] ?? []) {
1519
+ const budget = parseBudget(entry);
1520
+ if (budget instanceof Error) return usage(budget.message);
1521
+ budgets.push(budget);
1522
+ }
1523
+ if (budgets.length > 0 && out === void 0) return usage("--budget needs --out: the check reads the files of the folder");
1343
1524
  const widths = list("widths", "360,400,1280").map(Number);
1344
1525
  if (widths.length === 0 || widths.some((width) => !Number.isInteger(width) || width < 200 || width > 4e3)) return usage("--widths must be whole numbers from 200 to 4000");
1345
1526
  const schemes = list("schemes", "light,dark");
@@ -1401,6 +1582,9 @@ async function runCheckCli(argv, io) {
1401
1582
  } catch (error) {
1402
1583
  return usage(error instanceof Error ? error.message : String(error));
1403
1584
  }
1585
+ const bareErrors = text("bare-errors") ?? readBareErrorMode(io.cwd);
1586
+ if (bareErrors instanceof Error) return usage(bareErrors.message);
1587
+ if (!BARE_ERROR_MODES.includes(bareErrors)) return usage(`--bare-errors must be fail or report, not "${bareErrors}"`);
1404
1588
  const shots = text("shots");
1405
1589
  const result = await checkSite({
1406
1590
  out: out === void 0 ? void 0 : at(out),
@@ -1416,10 +1600,14 @@ async function runCheckCli(argv, io) {
1416
1600
  settleMs,
1417
1601
  timeoutMs,
1418
1602
  offline: values["offline"] === true,
1603
+ budgets,
1604
+ bareErrors,
1419
1605
  log: (line) => io.stdout(`${line}\n`)
1420
1606
  });
1421
1607
  const failed = result.views.filter((view) => !view.ok).length;
1422
- io.stdout(`site-pages check: ${result.views.length - failed} of ${result.views.length} views passed (${result.browser}).\n`);
1608
+ const overBudget = (result.budgets ?? []).filter((budget) => !budget.ok).length;
1609
+ const budgetText = overBudget > 0 ? ` ${overBudget} size budget(s) failed.` : "";
1610
+ io.stdout(`site-pages check: ${result.views.length - failed} of ${result.views.length} views passed (${result.browser}).${budgetText}\n`);
1423
1611
  const step = io.env["GITHUB_STEP_SUMMARY"];
1424
1612
  if (step) appendFileSync(step, summary(result));
1425
1613
  return result.ok ? 0 : 1;