@somewhere-cloud/cli 0.38.126 → 0.38.127

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 CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.38.127
2
+
3
+ - Starter test checks continue after independent failures and explain skipped prerequisites. Use `somewhere test --fail-fast` to stop each app-check script after its first failure.
4
+ - Explain how to add a missing data-loaded marker and show the step, expected and observed outcomes, and evidence in the test summary.
5
+
1
6
  ## 0.38.126
2
7
 
3
8
  - A claim link connects the CLI only to the claimed project. Use `somewhere login` for account access.
@@ -38368,8 +38368,8 @@ tests/app-check.mjs: change its checks to the journeys you changed and your acce
38368
38368
  Keep each run short:
38369
38369
  - Short waits: page.setDefaultTimeout(5_000) on every page; a deployed app answers in under
38370
38370
  a second. Never sleep for a fixed time: wait for the thing itself (the text, the response).
38371
- - Stop at the first failure and print what the page showed (page.url(), the visible error
38372
- text). Checks after a failure only wait out their timeouts. app.check() does both.
38371
+ - Keep independent checks running. For a dependent check, pass { requires: { name, passed } }
38372
+ to app.check() using the earlier check's boolean result, so a skip explains what it needed.
38373
38373
  - After a fix, rerun the scripts that failed, each one whole: npx @somewhere-cloud/cli test --failed.
38374
38374
  The CLI supplies its test helpers when it runs your tests. For the first browser test, install Playwright with npm install -D --save-exact @playwright/test@1.65.0.
38375
38375
  For a local Vite server, install the frontend tools with npm install -D --save-exact vite@7.2.2.
@@ -41047,84 +41047,84 @@ var init_init_test_template = __esm({
41047
41047
  "dist/lib/init-test-template.js"() {
41048
41048
  "use strict";
41049
41049
  init_first_cli_permission();
41050
- SCRIPT = /* @__PURE__ */ __name((privateData) => `// tests/app-check.mjs \u2014 an ordinary Playwright script for this app: change the checks to match
41051
- // what you built. Run it after a successful deploy, never after a refused one:
41050
+ SCRIPT = /* @__PURE__ */ __name((privateData) => `// Change these Playwright checks to match your app. Run after a successful deploy.
41052
41051
  // ${FIRST_CLI_PERMISSION}
41053
41052
  // npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
41054
- // Tests that need the email inbox work after you claim the app.
41055
- // It writes its result once to .somewhere/app-check.json; the exit code is the verdict.
41056
- // It stops at the first failed check and prints the page's URL and visible error text.
41057
- // After a fix, rerun the scripts that failed, each one whole: npx @somewhere-cloud/cli test --failed.
41058
- // From a .cjs script: const { openAppTest } = require('@somewhere-cloud/cli/script');
41053
+ // Results: .somewhere/app-check.json. Rerun failed scripts with npx @somewhere-cloud/cli test --failed.
41059
41054
  import { chromium } from '@playwright/test';
41060
41055
  import { openAppTest${privateData ? ", captureResponses, dataReady" : ""} } from '@somewhere-cloud/cli/script';
41061
-
41062
41056
  const app = await openAppTest(); // stops if this folder has changes the live release lacks
41063
41057
  const browser = await chromium.launch(app.launchOptions());
41064
- // One person = one browser context, signed up through the app's own form (accounts are
41065
- // deleted by exact id in finish()).
41066
41058
  const person = async () => {
41067
41059
  const page = await browser.newPage({ baseURL: app.origin });
41068
41060
  page.setDefaultTimeout(5_000); // a deployed app answers in well under a second; never sleep, wait for the thing itself
41069
41061
  return { page, account: await app.signUp(page) };
41070
41062
  };
41071
41063
  try {
41072
- await app.check('the sign-in page loads', async () => {
41064
+ await app.check('the sign-in page loads', async (at) => {
41073
41065
  const page = await browser.newPage({ baseURL: app.origin });
41074
41066
  try {
41075
41067
  await page.goto('/');
41068
+ at('Wait for the signed-out page', '[data-app-state="signed-out"]');
41076
41069
  await page.locator('[data-app-state="signed-out"]').waitFor({ timeout: 5_000 });
41077
- } finally {
41078
- await page.close();
41079
- }
41070
+ } finally { await page.close(); }
41080
41071
  });
41081
41072
  let ana, ben;
41082
- const signedUp = await app.check('sign up through the app', async () => {
41073
+ const needsSignup = { name: 'sign up through the app', passed: false };
41074
+ needsSignup.passed = await app.check(needsSignup.name, async () => {
41083
41075
  // Finish both attempts before cleanup, even if one fails.
41084
41076
  const people = await Promise.allSettled([person(), person()]);
41085
41077
  for (const result of people) if (result.status === 'rejected') throw result.reason;
41086
41078
  [ana, ben] = people.map(result => result.value);
41087
41079
  });
41088
- if (signedUp) {
41089
- await app.check('the signed-in page shows the account', () => ana.page.getByText(ana.account.email).waitFor());
41090
- await app.check('sign out, then sign back in', async () => {
41091
- await app.signOut(ana.page);
41092
- await app.signIn(ana.page, ana.account);
41093
- });
41094
- ${privateData ? ` await app.check('a note stays private to its owner', async () => {
41095
- const secret = 'private ' + crypto.randomUUID(); // a unique value: search for it, not a common word
41096
- await ana.page.getByLabel('Title').fill(secret);
41097
- await ana.page.getByRole('button', { name: 'Add note' }).click();
41098
- await ana.page.getByRole('heading', { name: secret }).waitFor();
41099
- const seen = captureResponses(ben.page);
41080
+ await app.check('the signed-in page shows the account', () => ana.page.getByText(ana.account.email).waitFor(), { requires: needsSignup });
41081
+ const roundTrip = 'sign out, then sign back in';
41082
+ const signedBackIn = await app.check(roundTrip, async (at) => {
41083
+ await app.signOut(ana.page);
41084
+ at('Sign back in');
41085
+ await app.signIn(ana.page, ana.account);
41086
+ }, { requires: needsSignup });
41087
+ ${privateData ? ` await app.check('a note stays private to its owner', async (at) => {
41088
+ const secret = 'private ' + crypto.randomUUID();
41089
+ at('Create the first person\u2019s note');
41090
+ await ana.page.getByLabel('Title').fill(secret);
41091
+ await ana.page.getByRole('button', { name: 'Add note' }).click();
41092
+ await ana.page.getByRole('heading', { name: secret }).waitFor();
41093
+ const seen = captureResponses(ben.page);
41094
+ try {
41100
41095
  await ben.page.reload();
41101
- await dataReady(ben.page); // the list has loaded, not merely "signed in"
41102
- const leaks = await seen.find(secret);
41103
- if (leaks.length) throw new Error('the other person received the note: ' + JSON.stringify(leaks));
41104
- const { data: [note] } = await app.data(ana.page, { table: 'notes', operation: 'list', where: { title: secret } });
41105
- await app.expectRefused(ben.page, { table: 'notes', operation: 'get', id: note.id }, { allowed: ana.page });
41106
- await app.expectRefused(ben.page, { table: 'notes', operation: 'update', id: note.id, values: { title: 'changed' } }, { allowed: ana.page });
41107
- await app.expectRefused(ben.page, { table: 'notes', operation: 'delete', id: note.id }, { allowed: ana.page });
41108
- });
41109
- ` : ` // Your own tables (db/schema.ts), called as a signed-in person: app.data adds the release's
41110
- // data contract and the Origin, and says ok, empty or refused. No need to read either from the page.
41111
- // const { data: [task] } = await app.data(ana.page, { table: 'tasks', operation: 'list' });
41112
- // await app.expectRefused(ben.page, { table: 'tasks', operation: 'get', id: task.id }, { allowed: ana.page });
41113
- `} // A list item opens its page when a person clicks the item itself. Click the item element, not a link
41114
- // inside it: a test that clicks the inner link passes even when clicking the item does nothing.
41115
- // await ana.page.getByTestId('team-item').first().click();
41116
- // await ana.page.getByTestId('team-name').waitFor(); // the item's own page, reached in the app
41117
- await app.check('at phone width nothing scrolls sideways', async () => {
41118
- await ana.page.setViewportSize({ width: 390, height: 844 });
41119
- await ana.page.reload();
41120
- await ana.page.getByText(ana.account.email).waitFor();
41121
- const wide = await ana.page.evaluate(() => [document.documentElement, ...document.querySelectorAll('body *')]
41122
- .filter((el) => el.scrollWidth > el.clientWidth + 1
41123
- && (el === document.documentElement || ['auto', 'scroll'].includes(getComputedStyle(el).overflowX)))
41124
- .map((el) => el.tagName.toLowerCase() + (typeof el.className === 'string' && el.className ? '.' + el.className.split(' ')[0] : '')));
41125
- if (wide.length) throw new Error('scrolls sideways at 390 px: ' + wide.join(', '));
41126
- });
41127
- }
41096
+ // On the data view, set data-sw-data="loading" while fetching, "ready" once loaded, or "error" if fetching fails.
41097
+ at('Wait for the second person\u2019s notes to load', '[data-sw-data]');
41098
+ if (await dataReady(ben.page) === 'error') throw new Error('The second person\u2019s notes view reported a loading error.');
41099
+ const [leak] = await seen.find(secret);
41100
+ if (leak) {
41101
+ at('Check the second person\u2019s responses for the note', leak.url);
41102
+ throw new Error('The second person received the first person\u2019s note.');
41103
+ }
41104
+ } finally { seen.stop(); }
41105
+ at('Read the note as its owner');
41106
+ const owned = await app.data(ana.page, { table: 'notes', operation: 'list', where: { title: secret } });
41107
+ const note = owned.data?.[0];
41108
+ if (!note) throw new Error('The owner\u2019s request did not return the new note (HTTP ' + owned.status + ').');
41109
+ at('Check that the second person cannot read, edit, or delete the note');
41110
+ await app.expectRefused(ben.page, { table: 'notes', operation: 'get', id: note.id }, { allowed: ana.page });
41111
+ await app.expectRefused(ben.page, { table: 'notes', operation: 'update', id: note.id, values: { title: 'changed' } }, { allowed: ana.page });
41112
+ await app.expectRefused(ben.page, { table: 'notes', operation: 'delete', id: note.id }, { allowed: ana.page });
41113
+ }, { requires: needsSignup.passed ? { name: roundTrip, passed: signedBackIn } : needsSignup });
41114
+ ` : ` // After adding tables in db/schema.ts, test access with these helpers:
41115
+ // const { data: [task] } = await app.data(ana.page, { table: 'tasks', operation: 'list' });
41116
+ // await app.expectRefused(ben.page, { table: 'tasks', operation: 'get', id: task.id }, { allowed: ana.page });
41117
+ `} await app.check('at phone width nothing scrolls sideways', async (at) => {
41118
+ await ben.page.setViewportSize({ width: 390, height: 844 });
41119
+ await ben.page.reload();
41120
+ await ben.page.getByText(ben.account.email).waitFor();
41121
+ at('Measure horizontal overflow', app.origin);
41122
+ const wide = await ben.page.evaluate(() => [document.documentElement, ...document.querySelectorAll('body *')]
41123
+ .filter((el) => el.scrollWidth > el.clientWidth + 1
41124
+ && (el === document.documentElement || ['auto', 'scroll'].includes(getComputedStyle(el).overflowX)))
41125
+ .map((el) => el.tagName.toLowerCase() + (typeof el.className === 'string' && el.className ? '.' + el.className.split(' ')[0] : '')));
41126
+ if (wide.length) throw new Error('scrolls sideways at 390 px: ' + wide.join(', '));
41127
+ }, { requires: needsSignup });
41128
41128
  } finally {
41129
41129
  await app.finish(); // confirms the release, deletes the accounts, writes the result once
41130
41130
  await browser.close();
@@ -77335,9 +77335,21 @@ function describeReport(groups, options2 = {}) {
77335
77335
  }, "note");
77336
77336
  const failed = checks.filter((check2) => !check2.ok && !check2.skipped);
77337
77337
  const notRun = checks.filter((check2) => check2.skipped === "after-failure");
77338
- const skipped = checks.filter((check2) => check2.skipped === "needs-claim");
77338
+ const skipped = checks.filter((check2) => check2.skipped && check2.skipped !== "after-failure");
77339
77339
  const lines = [
77340
- ...failed.map((check2) => `FAIL ${check2.name}${note(check2.script)}: ${firstLine(check2.error) || "failed"}`),
77340
+ ...failed.flatMap((check2) => {
77341
+ const name = `FAIL ${check2.name}${note(check2.script)}`;
77342
+ const failure = check2.failure;
77343
+ if (!failure)
77344
+ return [`${name}: ${firstLine(check2.error) || "failed"}`];
77345
+ return [
77346
+ name,
77347
+ ` Expected: ${failure.expected}`,
77348
+ ` Happened: ${failure.happened}`,
77349
+ ` Step: ${failure.step}`,
77350
+ ...failure.evidence ? [` Evidence: ${failure.evidence}`] : []
77351
+ ];
77352
+ }),
77341
77353
  ...checks.filter((check2) => check2.ok).map((check2) => `PASS ${check2.name}${note(check2.script)}`),
77342
77354
  ...skipped.map((check2) => `SKIPPED ${check2.name}${note(check2.script)}: ${firstLine(check2.error)}`),
77343
77355
  ...notRun.map((check2) => `NOT RUN ${check2.name}${note(check2.script, "after the first failure")}`)
@@ -77345,9 +77357,10 @@ function describeReport(groups, options2 = {}) {
77345
77357
  const scripts = plural(groups.length, "script");
77346
77358
  if (!checks.length)
77347
77359
  lines.push(`FAILED: no check ran in ${scripts}: it stopped before its first check (its error is in the script's output).`);
77348
- else if (failed.length)
77349
- lines.push(`FAILED: ${failed.length} of ${plural(checks.length, "check")} in ${scripts}${notRun.length ? ` (${notRun.length} not run)` : ""}`);
77350
- else if (skipped.length)
77360
+ else if (failed.length) {
77361
+ const omitted = [skipped.length && `${skipped.length} skipped`, notRun.length && `${notRun.length} not run`].filter(Boolean);
77362
+ lines.push(`FAILED: ${failed.length} of ${plural(checks.length, "check")} in ${scripts}${omitted.length ? ` (${omitted.join(", ")})` : ""}`);
77363
+ } else if (skipped.length)
77351
77364
  lines.push(`${checks.length - skipped.length} passed, ${skipped.length} skipped in ${scripts}`);
77352
77365
  else
77353
77366
  lines.push(`PASSED: ${plural(checks.length, "check")} in ${scripts}`);
@@ -77355,7 +77368,7 @@ function describeReport(groups, options2 = {}) {
77355
77368
  lines.push(`Next: fix the error in the script's output, then run ${TEST_COMMAND} again.`);
77356
77369
  else if (failed.length)
77357
77370
  lines.push(`Next: fix what each FAIL line names, run ${DEPLOY_COMMAND}, then ${TEST_COMMAND} --failed to rerun each script that failed.`);
77358
- if (skipped.length)
77371
+ if (skipped.some((check2) => check2.skipped === "needs-claim"))
77359
77372
  lines.push(TEST_INBOX_CLAIM_NEXT);
77360
77373
  const files = [...new Set(groups.map((group) => group.resultFile).filter((file2) => Boolean(file2)))];
77361
77374
  if (files.length && (failed.length || !checks.length || options2.verbose))
@@ -131349,7 +131362,7 @@ var init_test_scripts = __esm({
131349
131362
 
131350
131363
  // dist/commands/test.js
131351
131364
  function registerTest(program2) {
131352
- program2.command("test [files...]").description("Run this project's tests: every tests/*.mjs and tests/*.cjs script (such as tests/app-check.mjs), or, when the project has tests/**/*.spec.ts, its Playwright specs against the live release (--preview: this folder's open preview)").option("--preview", "Test this folder's open preview (its own users, data copy and captured mail), pinned to the version saved when the run starts. Production is never touched.").option("--workers <count>", "Parallel workers", "5").option("--failed", "Rerun what failed last time: each failed tests/*.mjs or *.cjs script, all its checks (specs: only the failed tests)").option("--grep <name>", "Filter test names (subset)").option("--url <url>", "Unsupported in phase 1").option("--phone", "Run every test again in a 390x844 phone viewport ([phone] in results)").option("--json", "Print structured results").option("--verbose", "Also print where the full result file is when everything passed").action(async (files, opts) => {
131365
+ program2.command("test [files...]").description("Run this project's tests: every tests/*.mjs and tests/*.cjs script (such as tests/app-check.mjs), or, when the project has tests/**/*.spec.ts, its Playwright specs against the live release (--preview: this folder's open preview)").option("--preview", "Test this folder's open preview (its own users, data copy and captured mail), pinned to the version saved when the run starts. Production is never touched.").option("--workers <count>", "Parallel workers", "5").option("--failed", "Rerun what failed last time: each failed tests/*.mjs or *.cjs script, all its checks (specs: only the failed tests)").option("--fail-fast", "Stop app-check scripts at their first failed check").option("--grep <name>", "Filter test names (subset)").option("--url <url>", "Unsupported in phase 1").option("--phone", "Run every test again in a 390x844 phone viewport ([phone] in results)").option("--json", "Print structured results").option("--verbose", "Also print where the full result file is when everything passed").addHelpText("after", '\nFor the starter privacy check, mark the data view with data-sw-data="loading" while fetching, "ready" once data loads, or "error" if fetching fails.\n').action(async (files, opts) => {
131353
131366
  markProcessStart("cli");
131354
131367
  mark("cli:action");
131355
131368
  if (opts.url)
@@ -131371,6 +131384,8 @@ function registerTest(program2) {
131371
131384
  const scripts = opts.failed ? lastFailedScripts(root) : listScripts(root, files);
131372
131385
  if (opts.failed && !scripts.length)
131373
131386
  throw new Error("No failed scripts are recorded from the last run here; run somewhere test.");
131387
+ if (opts.failFast)
131388
+ process.env.SW_TEST_FAIL_FAST = "1";
131374
131389
  const results = await runScripts(root, scripts, []);
131375
131390
  await note;
131376
131391
  if (results.length)
@@ -131384,6 +131399,8 @@ function registerTest(program2) {
131384
131399
  process.exitCode = failed || !results.length ? 1 : 0;
131385
131400
  return;
131386
131401
  }
131402
+ if (opts.failFast)
131403
+ throw new Error("--fail-fast applies to app-check scripts (tests/*.mjs or *.cjs).");
131387
131404
  const outcome2 = await runTests({ root, ...opts.preview ? {} : { client: new ApiClient(getToken()) }, projectId, prepared: prepareRunner(root), options: { ...opts, files } });
131388
131405
  await note;
131389
131406
  mark("cli:exit");
@@ -132993,6 +133010,19 @@ import { basename as basename10, dirname as dirname15, join as join48, relative
132993
133010
  function launchOptions(extra = {}) {
132994
133011
  return { ...extra, args: ["--disable-features=AsyncDns", ...extra.args ?? []] };
132995
133012
  }
133013
+ function describeCheckFailure(message3, expected, step2, evidence, pageUrl) {
133014
+ const detail = /* @__PURE__ */ __name((pattern) => message3.match(pattern)?.[1]?.trim(), "detail");
133015
+ const observed = detail(/^Received(?: \w+)?: *(.*)$/m);
133016
+ const header = message3.split("\n").find((line) => line.trim())?.trim() || "The check did not finish.";
133017
+ const artifact = detail(/\b(HTTP [1-5][0-9]{2}(?: [A-Z][A-Z_0-9]+)?)/) ?? detail(/^(?:Locator|Selector): *(.*)$/mi) ?? evidence ?? pageUrl;
133018
+ const singleLine = /* @__PURE__ */ __name((value) => scrub(value).replace(/\s+/g, " ").trim().slice(0, 500), "singleLine");
133019
+ return {
133020
+ expected: singleLine(detail(/^Expected(?: \w+)?: *(.*)$/m) ?? expected),
133021
+ happened: singleLine(observed ? `Received ${observed}.` : header),
133022
+ step: singleLine(step2),
133023
+ ...artifact ? { evidence: singleLine(artifact) } : {}
133024
+ };
133025
+ }
132996
133026
  async function pageState(page) {
132997
133027
  if (page.isClosed())
132998
133028
  return "closed";
@@ -133072,7 +133102,15 @@ function captureResponses(page) {
133072
133102
  async function dataReady(scope, timeout = 5e3) {
133073
133103
  const root = typeof scope.goto === "function" ? scope.locator(":root") : scope;
133074
133104
  const views = root.locator("[data-sw-data]");
133075
- await views.first().waitFor({ state: "attached", timeout });
133105
+ try {
133106
+ await views.first().waitFor({ state: "attached", timeout });
133107
+ } catch (error3) {
133108
+ const page = root.page();
133109
+ if (error3 instanceof Error && error3.name === "TimeoutError" && page.url() !== "about:blank" && await page.evaluate('document.readyState !== "loading" && !!document.body').catch(() => false)) {
133110
+ throw new Error('The page loaded without the expected [data-sw-data] marker, which your app sets on the data view to "loading", "ready", or "error" as shown in `somewhere test --help`.');
133111
+ }
133112
+ throw error3;
133113
+ }
133076
133114
  await root.locator('[data-sw-data="loading"]').first().waitFor({ state: "detached", timeout }).catch(async () => {
133077
133115
  if (await root.locator('[data-sw-data="loading"]').count())
133078
133116
  throw new Error(`dataReady: a data view was still loading after ${timeout / 1e3} s`);
@@ -133095,6 +133133,7 @@ var init_app_test = __esm({
133095
133133
  init_test_diagnostics();
133096
133134
  init_test_timeline();
133097
133135
  __name(launchOptions, "launchOptions");
133136
+ __name(describeCheckFailure, "describeCheckFailure");
133098
133137
  __name(pageState, "pageState");
133099
133138
  __name(clientOf, "clientOf");
133100
133139
  __name(undeployedChanges, "undeployedChanges");
@@ -133268,19 +133307,26 @@ var init_app_test = __esm({
133268
133307
  }
133269
133308
  return result;
133270
133309
  }
133271
- /** Run one named check. The first failure stops the run: it prints the check, the error and
133272
- * what each signed-in page shows (URL, visible error text), and every later check is skipped
133273
- * instead of waiting out its own timeout. `somewhere test --failed` reruns a failed script whole,
133274
- * so setup done inside earlier checks runs again. */
133275
- async check(label, work) {
133310
+ /** Run one named check unless its prerequisite did not pass. Use at() inside a
133311
+ * check that has several steps. `somewhere test --failed` reruns the whole script. */
133312
+ async check(label, work, options2 = {}) {
133276
133313
  const name = scrub(label);
133277
133314
  if (this.stopped) {
133278
133315
  this.checks.push({ name, ok: false, ms: 0, skipped: "after-failure" });
133279
133316
  return false;
133280
133317
  }
133318
+ if (options2.requires && !options2.requires.passed) {
133319
+ this.checks.push({ name, ok: false, ms: 0, skipped: "prerequisite", error: `Requires \u201C${scrub(options2.requires.name)}\u201D, which did not pass.` });
133320
+ return false;
133321
+ }
133281
133322
  const start = performance.now();
133323
+ let step2 = label;
133324
+ let evidence;
133282
133325
  try {
133283
- await work();
133326
+ await work((current, artifact) => {
133327
+ step2 = current;
133328
+ evidence = artifact;
133329
+ });
133284
133330
  this.checks.push({ name, ok: true, ms: Math.round(performance.now() - start) });
133285
133331
  return true;
133286
133332
  } catch (error3) {
@@ -133291,14 +133337,12 @@ var init_app_test = __esm({
133291
133337
  await this.rememberPageSecrets();
133292
133338
  const pages = await Promise.all([...this.host.pages].map(pageState));
133293
133339
  const stopped = [...this.host.pages].map((page) => browserStoppedMessage(page, error3)).find(Boolean);
133294
- const message3 = stopped ?? scrub((error3 instanceof Error ? error3.message.split("\n").slice(0, 6).join("\n") : String(error3)) + pages.map((state, i) => `
133295
- page ${i + 1}: ${state}`).join(""));
133296
- this.checks.push({ name, ok: false, ms: Math.round(performance.now() - start), error: message3 });
133297
- this.stopped = true;
133298
- process.stdout.write(`FAIL ${name}
133299
- ${message3.replaceAll("\n", "\n ")}
133300
- Stopping here: later checks are skipped. After a fix, rerun the scripts that failed: ${TEST_COMMAND} --failed
133301
- `);
133340
+ const message3 = stopped ?? scrub(error3 instanceof Error ? error3.message : String(error3));
133341
+ const failure = describeCheckFailure(message3, options2.expected ?? name, step2, evidence, [...this.host.pages].find((page) => !page.isClosed())?.url() ?? this.origin);
133342
+ const detail = message3.split("\n").slice(0, 12).join("\n") + pages.map((state, i) => `
133343
+ page ${i + 1}: ${state}`).join("");
133344
+ this.checks.push({ name, ok: false, ms: Math.round(performance.now() - start), error: detail, failure });
133345
+ this.stopped = process.env.SW_TEST_FAIL_FAST === "1";
133302
133346
  return false;
133303
133347
  }
133304
133348
  }
@@ -133350,6 +133394,11 @@ Stopping here: later checks are skipped. After a fix, rerun the scripts that fai
133350
133394
  await this.control.close();
133351
133395
  if (cleanup.length)
133352
133396
  this.checks.push({ name: "cleanup of sign-up accounts", ok: false, ms: 0, error: cleanup.join("; ") });
133397
+ for (const check2 of this.checks) {
133398
+ if (!check2.ok && !check2.skipped && !check2.failure) {
133399
+ check2.failure = describeCheckFailure(check2.error ?? "", check2.name, check2.name, this.origin);
133400
+ }
133401
+ }
133353
133402
  const passed = this.checks.filter((check2) => check2.ok).length;
133354
133403
  const failed = this.checks.filter((check2) => !check2.ok && !check2.skipped).length;
133355
133404
  mkdirSync20(dirname15(this.resultsPath), { recursive: true });
@@ -133365,7 +133414,10 @@ Stopping here: later checks are skipped. After a fix, rerun the scripts that fai
133365
133414
  failed,
133366
133415
  checks: this.checks.map((check2) => ({ ...check2, ...check2.error ? { error: scrub(check2.error) } : {} }))
133367
133416
  }, null, 2) + "\n");
133368
- const reported = this.checks.map((check2) => ({ name: scrub(check2.name), ok: check2.ok, ...check2.skipped ? { skipped: check2.skipped } : {}, ...check2.error ? { error: scrub(check2.error) } : {} }));
133417
+ const reported = this.checks.map(({ ms: ms2, ...check2 }) => ({
133418
+ ...check2,
133419
+ ...check2.error ? { error: scrub(check2.error) } : {}
133420
+ }));
133369
133421
  const resultFile = relative14(this.root, this.resultsPath);
133370
133422
  const handOver = process.env.SW_TEST_REPORT;
133371
133423
  if (handOver)