@somewhere-cloud/cli 0.38.128 → 0.38.129
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 +6 -0
- package/dist/lib/bundle.js +105 -129
- package/dist/lib/bundle.js.map +3 -3
- package/dist/types/lib/app-test.d.ts +6 -1
- package/dist/types/lib/form-auth.d.ts +1 -1
- package/dist/types/lib/test-control.d.ts +0 -3
- package/dist/types/lib/test-report.d.ts +1 -3
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## 0.38.129
|
|
2
|
+
|
|
3
|
+
- `somewhere test` runs the starter's full check on an unclaimed app: sign-up, sign-in and the privacy check.
|
|
4
|
+
- A skipped check no longer reads as a pass. The summary names each skipped check and why, and the run exits non-zero.
|
|
5
|
+
- Installing test tools such as Playwright no longer requires a redeploy before `somewhere test`. A changed package.json or lockfile prints a note instead.
|
|
6
|
+
|
|
1
7
|
## 0.38.128
|
|
2
8
|
|
|
3
9
|
- A claim connection can work on saved apps and create new ones. It can work on other existing apps when the owner selects that option.
|
package/dist/lib/bundle.js
CHANGED
|
@@ -38367,7 +38367,6 @@ After every deploy, somewhere verify checks the page loads and looks right at de
|
|
|
38367
38367
|
test to write. Journeys, several users and access rules go in tests/*.mjs with somewhere test.
|
|
38368
38368
|
${FIRST_CLI_PERMISSION}
|
|
38369
38369
|
Run somewhere test after a successful deploy: npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
|
|
38370
|
-
Tests that need the email inbox work after you claim the app.
|
|
38371
38370
|
It runs every tests/*.mjs and tests/*.cjs Playwright script and prints failures first. Start from
|
|
38372
38371
|
tests/app-check.mjs: change its checks to the journeys you changed and your access boundaries.
|
|
38373
38372
|
Keep each run short:
|
|
@@ -38780,8 +38779,8 @@ var init_skills_pack_generated = __esm({
|
|
|
38780
38779
|
BUNDLED_SKILLS_PACK = {
|
|
38781
38780
|
"schema": 1,
|
|
38782
38781
|
"name": "somewhere-skills",
|
|
38783
|
-
"version": "1+
|
|
38784
|
-
"sha256": "
|
|
38782
|
+
"version": "1+8aec0eae1728",
|
|
38783
|
+
"sha256": "8aec0eae1728bbe4d51fb8de104d1547e79c45a47800de7f4d9750d81f9e72c6",
|
|
38785
38784
|
"files": [
|
|
38786
38785
|
{
|
|
38787
38786
|
"path": "adopt/SKILL.md",
|
|
@@ -38790,8 +38789,8 @@ var init_skills_pack_generated = __esm({
|
|
|
38790
38789
|
},
|
|
38791
38790
|
{
|
|
38792
38791
|
"path": "deploy-verify-loop/SKILL.md",
|
|
38793
|
-
"sha256": "
|
|
38794
|
-
"content": '---\nname: deploy-verify-loop\ndescription: After edits, typecheck and run focused tests; verify the final deployed journey and rerun after relevant fixes.\n---\n\n# Deploy, verify, read the failure\n\n## The loop\n\n```bash\nsomewhere typecheck\nsomewhere deploy\n```\n\nDon\'t bundle the source yourself; the platform runs the frontend build.\n\nRun `somewhere claim` and open its link to keep a temporary app
|
|
38792
|
+
"sha256": "b394c2944cd64a48517dff6c80917b0e9332758f429e96600587ca91e4e951f8",
|
|
38793
|
+
"content": '---\nname: deploy-verify-loop\ndescription: After edits, typecheck and run focused tests; verify the final deployed journey and rerun after relevant fixes.\n---\n\n# Deploy, verify, read the failure\n\n## The loop\n\nBefore your first Somewhere command for a user, ask their permission and say where it will run, either as an npm package in your own cloud workspace (nothing installs on their computer) or as an npm package on their machine. Approval in their first message covers this.\n\n```bash\nsomewhere typecheck\nsomewhere deploy\n```\n\nDon\'t bundle the source yourself; the platform runs the frontend build.\n\nRun `somewhere claim` and open its link to keep a temporary app.\n\n```bash\nsomewhere deploy-check --run /api/hello -X POST -d \'{"name":"Ada"}\'\n```\n\n| Step | Command | What it tells you |\n|---|---|---|\n| Verify | `somewhere verify [--flow flow.json]` | Runs the live app at desktop and phone sizes: named steps, console/network health, both screenshots. |\n| Inspect | `somewhere browser [target]` | One page: screenshot, snapshot, DOM, network, or an evaluated expression. |\n| Diagnose | `somewhere logs --tail 10`, `somewhere errors` | Recent function output, then failures split into refused and exception. `errors` also works on a temporary project. |\n\n## A flow for verify --flow\n\n```json\n{ "actions": [{ "fill": "#title", "value": "Verify entry" }, { "fill": "#from_email", "value": "v@example.com" },\n { "click": "#send" }, { "expect": { "selector": "#status", "text": "Received" } }], "viewports": ["desktop"] }\n```\n\n`passed` requires successful steps and request expectations, no page errors, and no unexpected failed requests. It can be false even when every step succeeded.\n\n## Failure 1: the live site still shows the old version\n\nBrowser or CDN cache. Hard-reload (Cmd-Shift-R), or check with `curl -sI https://{subdomain}.somewhere.site`.\n\n## Failure 2: a route fails\n\nShow recent failures with a `kind` column: **refused** for a 4xx your own handler returned on purpose, **exception** for an uncaught throw or a 5xx.\n\nThe `stack` field is the single most useful field for debugging \u2014 it tells you the exact file + line in your code where the throw originated.\n\n| `somewhere rollback [project]` | `-y, --yes`, `--json` | Select the previous retained production release. By default this changes code without restoring data. |\n\nSources (`somewhere docs <topic>`): browser, cli, common-mistakes, deploy, getting-started, recipe-signed-in-app, troubleshooting.\n'
|
|
38795
38794
|
},
|
|
38796
38795
|
{
|
|
38797
38796
|
"path": "schema-changes/SKILL.md",
|
|
@@ -38815,8 +38814,8 @@ var init_skills_pack_generated = __esm({
|
|
|
38815
38814
|
},
|
|
38816
38815
|
{
|
|
38817
38816
|
"path": "email-and-test-inbox/SKILL.md",
|
|
38818
|
-
"sha256": "
|
|
38819
|
-
"content": "---\nname: email-and-test-inbox\ndescription: When the app sends email, or you need to test sign-up, magic-link, or reset mail without a real mailbox.\n---\n\n# Send email and read the test inbox\n\n## Notification after a save\n\nSave first, await durable job admission, then respond. Queued is not sent; the signed handler records the email outcome.\n\n## Send\n\n```ts\n// api/_lib/order-email.ts \u2014 call it from a handler that already checked who\n// receives this; the address comes from your saved order, never the request.\nexport function sendOrderShipped(\n sw: SomewhereRuntimeContext,\n order: { id: string; email: string; trackingNumber: string },\n): Promise<SomewhereEmailSendResult> {\n return sw.email.send({\n to: order.email,\n subject: 'Your order shipped',\n text: `Tracking: ${order.trackingNumber}`, // or html, or both\n idempotency_key: `order-shipped:${order.id}`,\n });\n}\n```\n\nIt can only email the project's owner and users who have verified their email address with this project; a pending sign-in or an unverified sign-up does not count
|
|
38817
|
+
"sha256": "9406a949a35f929f6b90616d757670f81eb85333f13c7d5b83cf44aed2b8174a",
|
|
38818
|
+
"content": "---\nname: email-and-test-inbox\ndescription: When the app sends email, or you need to test sign-up, magic-link, or reset mail without a real mailbox.\n---\n\n# Send email and read the test inbox\n\n## Notification after a save\n\nSave first, await durable job admission, then respond. Queued is not sent; the signed handler records the email outcome.\n\n## Send\n\n```ts\n// api/_lib/order-email.ts \u2014 call it from a handler that already checked who\n// receives this; the address comes from your saved order, never the request.\nexport function sendOrderShipped(\n sw: SomewhereRuntimeContext,\n order: { id: string; email: string; trackingNumber: string },\n): Promise<SomewhereEmailSendResult> {\n return sw.email.send({\n to: order.email,\n subject: 'Your order shipped',\n text: `Tracking: ${order.trackingNumber}`, // or html, or both\n idempotency_key: `order-shipped:${order.id}`,\n });\n}\n```\n\nIt can only email the project's owner and app users who have verified their email address with this project and signed in at least once; a pending sign-in or an unverified sign-up does not count. The platform adds a one-line unsubscribe footer and one-click unsubscribe headers; after a user unsubscribes, sends to them return `RECIPIENT_UNSUBSCRIBED`. Replies to the app's address are recorded in your project mailbox; read them with `sw.mail.project.list()`.\n\n## Test inbox\n\nAddresses `<anything>@<project-subdomain>.test.somewhere.site` never reach a real mailbox. Read it with `somewhere email test-inbox <address>` (or `sw.email.inbox(address)`) \u2192 `{ address, messages: [{ id, to, subject, text, html, magic_link, verification_code, created_at }] }`. `verification_code` is the code an auth message carries (the 6-digit email verification or sign-in code), or `null`.\n\n## Failure 1: MANAGED_SENDER_RECIPIENT_NOT_A_USER\n\nOther recipients return `MANAGED_SENDER_RECIPIENT_NOT_A_USER`; verify your own sender domain for outreach.\n\n## Failure 2: gating on status 'sent'\n\nDo not gate follow-up work on `status === 'sent'` alone: a captured test send and a replay of a delivered message are both successful sends.\n\nSources (`somewhere docs <topic>`): sw.email.\n"
|
|
38820
38819
|
},
|
|
38821
38820
|
{
|
|
38822
38821
|
"path": "design/SKILL.md",
|
|
@@ -42914,7 +42913,6 @@ function createFeatureTemplate(selection, options2) {
|
|
|
42914
42913
|
{ path: "AGENTS.md", content: INIT_AGENTS_MD.replace(/## Getting started[^]*?After edits:/, `## Testing
|
|
42915
42914
|
${FIRST_CLI_PERMISSION}
|
|
42916
42915
|
Run somewhere test after a successful deploy: npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
|
|
42917
|
-
Tests that need the email inbox work after you claim the app.
|
|
42918
42916
|
It runs every tests/*.mjs and tests/*.cjs Playwright script and prints failures first.
|
|
42919
42917
|
Start from tests/app-check.mjs: change its checks to the journeys you changed and your access boundaries.
|
|
42920
42918
|
Helpers from @somewhere-cloud/cli/script (import or require): signUp/signIn/signOut through your form,
|
|
@@ -77361,70 +77359,6 @@ var init_preview_record = __esm({
|
|
|
77361
77359
|
}
|
|
77362
77360
|
});
|
|
77363
77361
|
|
|
77364
|
-
// dist/lib/test-report.js
|
|
77365
|
-
function describeReport(groups, options2 = {}) {
|
|
77366
|
-
const many = groups.length > 1;
|
|
77367
|
-
const checks = groups.flatMap((group) => group.checks.map((check2) => ({ ...check2, script: many && check2.name !== group.script ? group.script : null })));
|
|
77368
|
-
const note = /* @__PURE__ */ __name((script, extra) => {
|
|
77369
|
-
const parts = [script, extra].filter(Boolean);
|
|
77370
|
-
return parts.length ? ` (${parts.join(", ")})` : "";
|
|
77371
|
-
}, "note");
|
|
77372
|
-
const failed = checks.filter((check2) => !check2.ok && !check2.skipped);
|
|
77373
|
-
const notRun = checks.filter((check2) => check2.skipped === "after-failure");
|
|
77374
|
-
const skipped = checks.filter((check2) => check2.skipped && check2.skipped !== "after-failure");
|
|
77375
|
-
const lines = [
|
|
77376
|
-
...failed.flatMap((check2) => {
|
|
77377
|
-
const name = `FAIL ${check2.name}${note(check2.script)}`;
|
|
77378
|
-
const failure = check2.failure;
|
|
77379
|
-
if (!failure)
|
|
77380
|
-
return [`${name}: ${firstLine(check2.error) || "failed"}`];
|
|
77381
|
-
return [
|
|
77382
|
-
name,
|
|
77383
|
-
` Expected: ${failure.expected}`,
|
|
77384
|
-
` Happened: ${failure.happened}`,
|
|
77385
|
-
` Step: ${failure.step}`,
|
|
77386
|
-
...failure.evidence ? [` Evidence: ${failure.evidence}`] : []
|
|
77387
|
-
];
|
|
77388
|
-
}),
|
|
77389
|
-
...checks.filter((check2) => check2.ok).map((check2) => `PASS ${check2.name}${note(check2.script)}`),
|
|
77390
|
-
...skipped.map((check2) => `SKIPPED ${check2.name}${note(check2.script)}: ${firstLine(check2.error)}`),
|
|
77391
|
-
...notRun.map((check2) => `NOT RUN ${check2.name}${note(check2.script, "after the first failure")}`)
|
|
77392
|
-
];
|
|
77393
|
-
const scripts = plural(groups.length, "script");
|
|
77394
|
-
if (!checks.length)
|
|
77395
|
-
lines.push(`FAILED: no check ran in ${scripts}: it stopped before its first check (its error is in the script's output).`);
|
|
77396
|
-
else if (failed.length) {
|
|
77397
|
-
const omitted = [skipped.length && `${skipped.length} skipped`, notRun.length && `${notRun.length} not run`].filter(Boolean);
|
|
77398
|
-
lines.push(`FAILED: ${failed.length} of ${plural(checks.length, "check")} in ${scripts}${omitted.length ? ` (${omitted.join(", ")})` : ""}`);
|
|
77399
|
-
} else if (skipped.length)
|
|
77400
|
-
lines.push(`${checks.length - skipped.length} passed, ${skipped.length} skipped in ${scripts}`);
|
|
77401
|
-
else
|
|
77402
|
-
lines.push(`PASSED: ${plural(checks.length, "check")} in ${scripts}`);
|
|
77403
|
-
if (!checks.length)
|
|
77404
|
-
lines.push(`Next: fix the error in the script's output, then run ${TEST_COMMAND} again.`);
|
|
77405
|
-
else if (failed.length)
|
|
77406
|
-
lines.push(`Next: fix what each FAIL line names, run ${DEPLOY_COMMAND}, then ${TEST_COMMAND} --failed to rerun each script that failed.`);
|
|
77407
|
-
if (skipped.some((check2) => check2.skipped === "needs-claim"))
|
|
77408
|
-
lines.push(TEST_INBOX_CLAIM_NEXT);
|
|
77409
|
-
const files = [...new Set(groups.map((group) => group.resultFile).filter((file2) => Boolean(file2)))];
|
|
77410
|
-
if (files.length && (failed.length || !checks.length || options2.verbose))
|
|
77411
|
-
lines.push(`Full result: ${files.join(", ")}`);
|
|
77412
|
-
return lines;
|
|
77413
|
-
}
|
|
77414
|
-
var DEPLOY_COMMAND, TEST_COMMAND, TEST_INBOX_CLAIM_REASON, TEST_INBOX_CLAIM_NEXT, firstLine, plural;
|
|
77415
|
-
var init_test_report = __esm({
|
|
77416
|
-
"dist/lib/test-report.js"() {
|
|
77417
|
-
"use strict";
|
|
77418
|
-
DEPLOY_COMMAND = "npx @somewhere-cloud/cli deploy";
|
|
77419
|
-
TEST_COMMAND = "npx @somewhere-cloud/cli test";
|
|
77420
|
-
TEST_INBOX_CLAIM_REASON = "needs a claimed app: run somewhere claim";
|
|
77421
|
-
TEST_INBOX_CLAIM_NEXT = "Next: run somewhere claim, open its link, then run somewhere test again.";
|
|
77422
|
-
firstLine = /* @__PURE__ */ __name((text) => (text ?? "").split("\n").map((line) => line.trim()).find((line) => line && !/^(?:hint:|Usage details:|Platform bug reports:)/i.test(line)) ?? "", "firstLine");
|
|
77423
|
-
plural = /* @__PURE__ */ __name((n, word) => `${n} ${word}${n === 1 ? "" : "s"}`, "plural");
|
|
77424
|
-
__name(describeReport, "describeReport");
|
|
77425
|
-
}
|
|
77426
|
-
});
|
|
77427
|
-
|
|
77428
77362
|
// dist/lib/test-diagnostics.js
|
|
77429
77363
|
function rememberSecrets(...values) {
|
|
77430
77364
|
for (const value of values)
|
|
@@ -77536,8 +77470,6 @@ function productionControl(client, target) {
|
|
|
77536
77470
|
projectId,
|
|
77537
77471
|
target,
|
|
77538
77472
|
async inbox(address, wait) {
|
|
77539
|
-
if (loadConfig()?.temporary)
|
|
77540
|
-
throw new TestInboxNeedsClaim();
|
|
77541
77473
|
const body = await client.call("GET", "/email/test-inbox", void 0, { project_id: projectId, address, limit: 20, ...wait ? { wait_ms: wait.ms ?? 1e4, since: wait.since } : {} });
|
|
77542
77474
|
return messagesAfter(body.messages, address, 0);
|
|
77543
77475
|
},
|
|
@@ -77688,7 +77620,7 @@ async function deletePreviewManagedUser(tool, id) {
|
|
|
77688
77620
|
return isDeadPreviewCredential(error3) ? "the preview is closed, promoted or expired, or its credential was revoked" : String(error3 instanceof Error ? error3.message : error3).slice(0, 200);
|
|
77689
77621
|
}
|
|
77690
77622
|
}
|
|
77691
|
-
var
|
|
77623
|
+
var PREVIEW_CLOSED_MESSAGE, PreviewRunError;
|
|
77692
77624
|
var init_test_control = __esm({
|
|
77693
77625
|
"dist/lib/test-control.js"() {
|
|
77694
77626
|
"use strict";
|
|
@@ -77699,16 +77631,7 @@ var init_test_control = __esm({
|
|
|
77699
77631
|
init_test_target();
|
|
77700
77632
|
init_test_identities();
|
|
77701
77633
|
init_form_accounts();
|
|
77702
|
-
init_test_report();
|
|
77703
77634
|
init_test_diagnostics();
|
|
77704
|
-
TestInboxNeedsClaim = class extends Error {
|
|
77705
|
-
static {
|
|
77706
|
-
__name(this, "TestInboxNeedsClaim");
|
|
77707
|
-
}
|
|
77708
|
-
constructor() {
|
|
77709
|
-
super(TEST_INBOX_CLAIM_REASON);
|
|
77710
|
-
}
|
|
77711
|
-
};
|
|
77712
77635
|
__name(productionControl, "productionControl");
|
|
77713
77636
|
__name(openProductionControl, "openProductionControl");
|
|
77714
77637
|
PREVIEW_CLOSED_MESSAGE = "The preview is closed, promoted or expired, or its credential was revoked. Open or continue one with `somewhere preview`, then run the tests again.";
|
|
@@ -77928,8 +77851,6 @@ function prepareDeployTests(start) {
|
|
|
77928
77851
|
async function runDeployTests(input) {
|
|
77929
77852
|
const release2 = input.release ?? null;
|
|
77930
77853
|
const notRun = /* @__PURE__ */ __name((reason) => ({ status: "not_run", release: release2, reason }), "notRun");
|
|
77931
|
-
if (input.temporary)
|
|
77932
|
-
return notRun("a temporary project cannot run tests; claim it, link this folder and run somewhere test");
|
|
77933
77854
|
if (!input.projectId || !input.release)
|
|
77934
77855
|
return notRun("the deploy did not name its project and release");
|
|
77935
77856
|
if (input.renderPending) {
|
|
@@ -77966,6 +77887,8 @@ function formatDeployTestsLine(tests) {
|
|
|
77966
77887
|
const skipped = r?.skipped ? `, ${r.skipped} skipped (a skipped test proves nothing)` : "";
|
|
77967
77888
|
if (tests.status === "passed")
|
|
77968
77889
|
return `The deploy is live and its tests passed: ${r?.passed ?? 0} passed${skipped} on ${tests.release}.`;
|
|
77890
|
+
if (tests.status === "failed" && !r?.failed && r?.skipped && !r?.setupErrors && !tests.reason)
|
|
77891
|
+
return `The deploy is live. Its tests did NOT all run: ${r.skipped} skipped (a skipped test proves nothing), ${r.passed ?? 0} passed on ${tests.release}. Each SKIPPED line above says why.`;
|
|
77969
77892
|
if (tests.status === "failed")
|
|
77970
77893
|
return `The deploy is live. Its tests FAILED: ${r?.failed ?? 0} failed, ${r?.passed ?? 0} passed${skipped}${r?.setupErrors ? `, ${r.setupErrors} setup errors` : ""}${tests.reason ? ` (${tests.reason})` : ""} on ${tests.release}. After fixing a test: somewhere test --failed. After fixing the app: somewhere deploy --test.`;
|
|
77971
77894
|
return `The deploy is live. Its tests did NOT run: ${tests.reason}.`;
|
|
@@ -77984,19 +77907,19 @@ var init_deploy_tests = __esm({
|
|
|
77984
77907
|
});
|
|
77985
77908
|
|
|
77986
77909
|
// dist/lib/surface-counts.js
|
|
77987
|
-
function
|
|
77910
|
+
function plural(count2, one, many) {
|
|
77988
77911
|
return `${count2} ${count2 === 1 ? one : many}`;
|
|
77989
77912
|
}
|
|
77990
77913
|
function formatPublishSurface(counts) {
|
|
77991
77914
|
const parts = [];
|
|
77992
77915
|
if (counts.staticFiles !== null) {
|
|
77993
|
-
parts.push(
|
|
77916
|
+
parts.push(plural(counts.staticFiles, "static file", "static files"));
|
|
77994
77917
|
}
|
|
77995
77918
|
if (counts.functions === "some") {
|
|
77996
77919
|
parts.push("functions");
|
|
77997
77920
|
} else if (typeof counts.functions === "number") {
|
|
77998
77921
|
if (counts.functions > 0 || parts.length === 0) {
|
|
77999
|
-
parts.push(
|
|
77922
|
+
parts.push(plural(counts.functions, "function", "functions"));
|
|
78000
77923
|
}
|
|
78001
77924
|
}
|
|
78002
77925
|
if (parts.length === 0)
|
|
@@ -78039,7 +77962,7 @@ var init_surface_counts = __esm({
|
|
|
78039
77962
|
"dist/lib/surface-counts.js"() {
|
|
78040
77963
|
"use strict";
|
|
78041
77964
|
init_cli_invocation();
|
|
78042
|
-
__name(
|
|
77965
|
+
__name(plural, "plural");
|
|
78043
77966
|
__name(formatPublishSurface, "formatPublishSurface");
|
|
78044
77967
|
__name(countPublishSurface, "countPublishSurface");
|
|
78045
77968
|
__name(countFunctionRoutes, "countFunctionRoutes");
|
|
@@ -81994,10 +81917,10 @@ function formatTempExpiry(expiresAt, ttlSeconds, nowMs = Date.now()) {
|
|
|
81994
81917
|
if (remainingMs <= 0)
|
|
81995
81918
|
return "Temporary app. It has expired.";
|
|
81996
81919
|
const minutes = Math.ceil(remainingMs / 6e4);
|
|
81997
|
-
const remaining = minutes >= 60 ?
|
|
81920
|
+
const remaining = minutes >= 60 ? plural2(Math.round(minutes / 60), "hour") : plural2(minutes < 5 ? minutes : Math.min(55, Math.round(minutes / 5) * 5), "minute");
|
|
81998
81921
|
return `Temporary app. Expires in about ${remaining}.`;
|
|
81999
81922
|
}
|
|
82000
|
-
function
|
|
81923
|
+
function plural2(count2, singular, pluralWord = `${singular}s`) {
|
|
82001
81924
|
return `${count2} ${count2 === 1 ? singular : pluralWord}`;
|
|
82002
81925
|
}
|
|
82003
81926
|
function formatElapsed(at2, nowMs = Date.now()) {
|
|
@@ -82010,15 +81933,15 @@ function formatElapsed(at2, nowMs = Date.now()) {
|
|
|
82010
81933
|
if (minutes < 1)
|
|
82011
81934
|
return " just now";
|
|
82012
81935
|
if (minutes < 60)
|
|
82013
|
-
return ` ${
|
|
81936
|
+
return ` ${plural2(minutes, "minute")} ago`;
|
|
82014
81937
|
const hours = Math.floor(minutes / 60);
|
|
82015
81938
|
if (hours < 24)
|
|
82016
|
-
return ` ${
|
|
81939
|
+
return ` ${plural2(hours, "hour")} ago`;
|
|
82017
81940
|
const days = Math.floor(hours / 24);
|
|
82018
81941
|
if (days < 30)
|
|
82019
|
-
return ` ${
|
|
81942
|
+
return ` ${plural2(days, "day")} ago`;
|
|
82020
81943
|
const months = Math.floor(days / 30);
|
|
82021
|
-
return ` ${
|
|
81944
|
+
return ` ${plural2(months, "month")} ago`;
|
|
82022
81945
|
}
|
|
82023
81946
|
function formatChangeSource(source) {
|
|
82024
81947
|
const normalized = source?.trim().toLowerCase();
|
|
@@ -82061,7 +81984,7 @@ function formatStaleBaseExplanation(details, nowMs = Date.now()) {
|
|
|
82061
81984
|
const elapsed = formatElapsed(details.last_change_at, nowMs);
|
|
82062
81985
|
const fileList = files.slice(0, 10).join(", ");
|
|
82063
81986
|
const more = files.length > 10 ? `, and ${files.length - 10} more` : "";
|
|
82064
|
-
const changeSummary = files.length > 0 ? `${
|
|
81987
|
+
const changeSummary = files.length > 0 ? `${plural2(files.length, "file")} edited${source}${elapsed}: ${fileList}${more}` : `remote edits${source}${elapsed}`;
|
|
82065
81988
|
const versionSummary = details.current_version !== void 0 && details.base_version !== void 0 ? `Remote is now v${details.current_version}; this machine last deployed v${details.base_version}.` : null;
|
|
82066
81989
|
return [
|
|
82067
81990
|
`This project changed since your last deploy from this machine \u2014 ${changeSummary}. Your deploy was NOT applied.`,
|
|
@@ -82810,7 +82733,7 @@ Existing project: \`${cliInvocation()} init --link --project <ref>\` (see \`${cl
|
|
|
82810
82733
|
return { status: "not_run", release: release2, reason: "functions failed to deploy" };
|
|
82811
82734
|
if (verificationFailed)
|
|
82812
82735
|
return { status: "not_run", release: release2, reason: "the deploy verification did not pass" };
|
|
82813
|
-
return runDeployTests({ client, root: deployStateEntry?.dir ?? targetDir, projectId: result.project_id ?? projectId ?? void 0,
|
|
82736
|
+
return runDeployTests({ client, root: deployStateEntry?.dir ?? targetDir, projectId: result.project_id ?? projectId ?? void 0, json: Boolean(opts.json), release: release2 ?? void 0, renderPending: postLive.kind === "timeout", prepared: prepareDeployTests(() => prepareRunner(deployStateEntry?.dir ?? targetDir)) });
|
|
82814
82737
|
}, "runReleaseTests");
|
|
82815
82738
|
const verificationNextSteps = besideRealLogin ? [
|
|
82816
82739
|
"Inspect the live URL; keep this project and its claim URL.",
|
|
@@ -83449,7 +83372,7 @@ var init_deploy = __esm({
|
|
|
83449
83372
|
__name(randomSuffix, "randomSuffix");
|
|
83450
83373
|
__name(deriveNewProjectName, "deriveNewProjectName");
|
|
83451
83374
|
__name(formatTempExpiry, "formatTempExpiry");
|
|
83452
|
-
__name(
|
|
83375
|
+
__name(plural2, "plural");
|
|
83453
83376
|
__name(formatElapsed, "formatElapsed");
|
|
83454
83377
|
__name(formatChangeSource, "formatChangeSource");
|
|
83455
83378
|
__name(readString, "readString");
|
|
@@ -131227,6 +131150,66 @@ var init_reference_check_note = __esm({
|
|
|
131227
131150
|
}
|
|
131228
131151
|
});
|
|
131229
131152
|
|
|
131153
|
+
// dist/lib/test-report.js
|
|
131154
|
+
function describeReport(groups, options2 = {}) {
|
|
131155
|
+
const many = groups.length > 1;
|
|
131156
|
+
const checks = groups.flatMap((group) => group.checks.map((check2) => ({ ...check2, script: many && check2.name !== group.script ? group.script : null })));
|
|
131157
|
+
const note = /* @__PURE__ */ __name((script, extra) => {
|
|
131158
|
+
const parts = [script, extra].filter(Boolean);
|
|
131159
|
+
return parts.length ? ` (${parts.join(", ")})` : "";
|
|
131160
|
+
}, "note");
|
|
131161
|
+
const failed = checks.filter((check2) => !check2.ok && !check2.skipped);
|
|
131162
|
+
const notRun = checks.filter((check2) => check2.skipped === "after-failure");
|
|
131163
|
+
const skipped = checks.filter((check2) => check2.skipped && check2.skipped !== "after-failure");
|
|
131164
|
+
const lines = [
|
|
131165
|
+
...failed.flatMap((check2) => {
|
|
131166
|
+
const name = `FAIL ${check2.name}${note(check2.script)}`;
|
|
131167
|
+
const failure = check2.failure;
|
|
131168
|
+
if (!failure)
|
|
131169
|
+
return [`${name}: ${firstLine(check2.error) || "failed"}`];
|
|
131170
|
+
return [
|
|
131171
|
+
name,
|
|
131172
|
+
` Expected: ${failure.expected}`,
|
|
131173
|
+
` Happened: ${failure.happened}`,
|
|
131174
|
+
` Step: ${failure.step}`,
|
|
131175
|
+
...failure.evidence ? [` Evidence: ${failure.evidence}`] : []
|
|
131176
|
+
];
|
|
131177
|
+
}),
|
|
131178
|
+
...checks.filter((check2) => check2.ok).map((check2) => `PASS ${check2.name}${note(check2.script)}`),
|
|
131179
|
+
...skipped.map((check2) => `SKIPPED ${check2.name}${note(check2.script)}: ${firstLine(check2.error)}`),
|
|
131180
|
+
...notRun.map((check2) => `NOT RUN ${check2.name}${note(check2.script, "after the first failure")}`)
|
|
131181
|
+
];
|
|
131182
|
+
const scripts = plural3(groups.length, "script");
|
|
131183
|
+
if (!checks.length)
|
|
131184
|
+
lines.push(`FAILED: no check ran in ${scripts}: it stopped before its first check (its error is in the script's output).`);
|
|
131185
|
+
else if (failed.length) {
|
|
131186
|
+
const omitted = [skipped.length && `${skipped.length} skipped`, notRun.length && `${notRun.length} not run`].filter(Boolean);
|
|
131187
|
+
lines.push(`FAILED: ${failed.length} of ${plural3(checks.length, "check")} in ${scripts}${omitted.length ? ` (${omitted.join(", ")})` : ""}`);
|
|
131188
|
+
} else if (skipped.length)
|
|
131189
|
+
lines.push(`NOT ALL CHECKED: ${checks.length - skipped.length} passed, ${skipped.length} skipped in ${scripts}. A skipped check proves nothing: ${skipped.map((check2) => `\u201C${check2.name}\u201D (${firstLine(check2.error).replace(/\.$/, "") || "skipped"})`).join("; ")}.`);
|
|
131190
|
+
else
|
|
131191
|
+
lines.push(`PASSED: ${plural3(checks.length, "check")} in ${scripts}`);
|
|
131192
|
+
if (!checks.length)
|
|
131193
|
+
lines.push(`Next: fix the error in the script's output, then run ${TEST_COMMAND} again.`);
|
|
131194
|
+
else if (failed.length)
|
|
131195
|
+
lines.push(`Next: fix what each FAIL line names, run ${DEPLOY_COMMAND}, then ${TEST_COMMAND} --failed to rerun each script that failed.`);
|
|
131196
|
+
const files = [...new Set(groups.map((group) => group.resultFile).filter((file2) => Boolean(file2)))];
|
|
131197
|
+
if (files.length && (failed.length || !checks.length || options2.verbose))
|
|
131198
|
+
lines.push(`Full result: ${files.join(", ")}`);
|
|
131199
|
+
return lines;
|
|
131200
|
+
}
|
|
131201
|
+
var DEPLOY_COMMAND, TEST_COMMAND, firstLine, plural3;
|
|
131202
|
+
var init_test_report = __esm({
|
|
131203
|
+
"dist/lib/test-report.js"() {
|
|
131204
|
+
"use strict";
|
|
131205
|
+
DEPLOY_COMMAND = "npx @somewhere-cloud/cli deploy";
|
|
131206
|
+
TEST_COMMAND = "npx @somewhere-cloud/cli test";
|
|
131207
|
+
firstLine = /* @__PURE__ */ __name((text) => (text ?? "").split("\n").map((line) => line.trim()).find((line) => line && !/^(?:hint:|Usage details:|Platform bug reports:)/i.test(line)) ?? "", "firstLine");
|
|
131208
|
+
plural3 = /* @__PURE__ */ __name((n, word) => `${n} ${word}${n === 1 ? "" : "s"}`, "plural");
|
|
131209
|
+
__name(describeReport, "describeReport");
|
|
131210
|
+
}
|
|
131211
|
+
});
|
|
131212
|
+
|
|
131230
131213
|
// dist/lib/test-scripts.js
|
|
131231
131214
|
import { createRequire as createRequire8 } from "node:module";
|
|
131232
131215
|
import { existsSync as existsSync36, mkdirSync as mkdirSync18, readFileSync as readFileSync40, readdirSync as readdirSync8, rmSync as rmSync14, statSync as statSync8, writeFileSync as writeFileSync24 } from "node:fs";
|
|
@@ -132480,7 +132463,6 @@ var init_test_reporter = __esm({
|
|
|
132480
132463
|
init_test_control();
|
|
132481
132464
|
init_test_identities();
|
|
132482
132465
|
init_test_diagnostics();
|
|
132483
|
-
init_test_report();
|
|
132484
132466
|
init_test_timeline();
|
|
132485
132467
|
markProcessStart("playwright");
|
|
132486
132468
|
firstLine2 = /* @__PURE__ */ __name((message3) => message3.replace(/^[^:\n]+:\d+: /, "").split("\n").find((line) => line.trim())?.trim().slice(0, 240) ?? "", "firstLine");
|
|
@@ -132517,11 +132499,11 @@ var init_test_reporter = __esm({
|
|
|
132517
132499
|
return location2 ? describeError({ message: "", location: location2 }).replace(/: $/, "") + ": " + message3 : message3;
|
|
132518
132500
|
}) : result.errors.map((error3) => describeError(error3));
|
|
132519
132501
|
const file2 = relative13(process.cwd(), test2.location.file);
|
|
132520
|
-
const
|
|
132521
|
-
const entry = { ...details, ...
|
|
132502
|
+
const skipReason = result.status === "skipped" ? scrub(result.annotations.find(({ type, description }) => type === "skip" && description)?.description ?? "no reason given").slice(0, 200) : void 0;
|
|
132503
|
+
const entry = { ...details, ...skipReason ? { skipReason } : {}, status: result.status, outcome: test2.outcome(), title: scrub(details.title).slice(0, 200), errors, step: result.steps.find((step2) => step2.error)?.category ?? "test body", file: file2, line: test2.location.line };
|
|
132522
132504
|
this.entries.push(entry);
|
|
132523
132505
|
if (process.env.SW_TEST_JSON !== "true") {
|
|
132524
|
-
console.log(
|
|
132506
|
+
console.log(skipReason ? `SKIPPED ${entry.title}: ${skipReason}` : `${result.status}: ${entry.title}`);
|
|
132525
132507
|
for (const note of entry.notes ?? [])
|
|
132526
132508
|
console.log(` note: ${scrub(note)}`);
|
|
132527
132509
|
if (result.status !== "passed" && result.status !== "skipped")
|
|
@@ -132540,7 +132522,6 @@ ${entry.errors.map((error3) => " " + error3.replaceAll("\n", "\n ")).join("\n"
|
|
|
132540
132522
|
async onEnd(result) {
|
|
132541
132523
|
const passed = this.entries.filter((entry) => entry.status === "passed" && entry.outcome === "expected").length;
|
|
132542
132524
|
const skipped = this.entries.filter((entry) => entry.status === "skipped").length;
|
|
132543
|
-
const needsClaim = this.entries.some((entry) => entry.skipReason === TEST_INBOX_CLAIM_REASON);
|
|
132544
132525
|
const expectedFailures = this.entries.filter((entry) => entry.status === "failed" && entry.outcome === "expected").length;
|
|
132545
132526
|
const failed = this.entries.filter((entry) => entry.outcome === "unexpected").length;
|
|
132546
132527
|
const startRelease = process.env.SW_TEST_RELEASE;
|
|
@@ -132608,12 +132589,10 @@ ${entry.errors.map((error3) => " " + error3.replaceAll("\n", "\n ")).join("\n"
|
|
|
132608
132589
|
if (versionLost) {
|
|
132609
132590
|
console.log(preview ? "The preview changed or closed during this run. Save it again with `somewhere preview` (or open a new one if it closed), then run all the tests again: somewhere test --preview" : "The live release changed during this run. Run all the tests again: somewhere test");
|
|
132610
132591
|
}
|
|
132611
|
-
if (needsClaim)
|
|
132612
|
-
console.log(TEST_INBOX_CLAIM_NEXT);
|
|
132613
132592
|
if (skipped)
|
|
132614
|
-
console.log(
|
|
132593
|
+
console.log(`NOT ALL RAN: ${skipped} skipped (each SKIPPED line above says why). A skipped test proves nothing until it runs.`);
|
|
132615
132594
|
}
|
|
132616
|
-
const status = result.status === "passed" && failed === 0 && this.errors === 0 &&
|
|
132595
|
+
const status = result.status === "passed" && failed === 0 && this.errors === 0 && skipped === 0 && passed > 0 ? "passed" : "failed";
|
|
132617
132596
|
if (status === "passed" && passed > 0 && process.env.SW_TEST_JSON !== "true")
|
|
132618
132597
|
console.log("The checks you wrote passed; say which requirements they do not cover.");
|
|
132619
132598
|
return { status };
|
|
@@ -132720,7 +132699,7 @@ async function step(page, name, work, beforeReport) {
|
|
|
132720
132699
|
} catch (error3) {
|
|
132721
132700
|
await beforeReport?.().catch(() => {
|
|
132722
132701
|
});
|
|
132723
|
-
if (error3 instanceof StepError
|
|
132702
|
+
if (error3 instanceof StepError)
|
|
132724
132703
|
throw error3;
|
|
132725
132704
|
const stopped = browserStoppedMessage(page, error3);
|
|
132726
132705
|
if (stopped)
|
|
@@ -132989,7 +132968,6 @@ var secretScreens, FIND_MS, DEFAULT_FORM, pick2, describe3, marks, lastSignInCod
|
|
|
132989
132968
|
var init_form_auth = __esm({
|
|
132990
132969
|
"dist/lib/form-auth.js"() {
|
|
132991
132970
|
"use strict";
|
|
132992
|
-
init_test_control();
|
|
132993
132971
|
init_test_diagnostics();
|
|
132994
132972
|
init_test_timeline();
|
|
132995
132973
|
init_form_accounts();
|
|
@@ -133088,6 +133066,9 @@ function clientOf(who) {
|
|
|
133088
133066
|
return who.request;
|
|
133089
133067
|
return who;
|
|
133090
133068
|
}
|
|
133069
|
+
function splitManifests(changed) {
|
|
133070
|
+
return { app: changed.filter((file2) => !PACKAGE_MANIFESTS.has(file2)), manifests: changed.filter((file2) => PACKAGE_MANIFESTS.has(file2)) };
|
|
133071
|
+
}
|
|
133091
133072
|
function undeployedChanges(root, projectId, preview = false) {
|
|
133092
133073
|
let base;
|
|
133093
133074
|
if (preview) {
|
|
@@ -133160,7 +133141,7 @@ async function dataReady(scope, timeout = 5e3) {
|
|
|
133160
133141
|
});
|
|
133161
133142
|
return await root.locator('[data-sw-data="error"]').count() ? "error" : "ready";
|
|
133162
133143
|
}
|
|
133163
|
-
var AppTest;
|
|
133144
|
+
var PACKAGE_MANIFESTS, AppTest;
|
|
133164
133145
|
var init_app_test = __esm({
|
|
133165
133146
|
"dist/lib/app-test.js"() {
|
|
133166
133147
|
"use strict";
|
|
@@ -133179,6 +133160,8 @@ var init_app_test = __esm({
|
|
|
133179
133160
|
__name(describeCheckFailure, "describeCheckFailure");
|
|
133180
133161
|
__name(pageState, "pageState");
|
|
133181
133162
|
__name(clientOf, "clientOf");
|
|
133163
|
+
PACKAGE_MANIFESTS = /* @__PURE__ */ new Set(["package.json", "package-lock.json", "npm-shrinkwrap.json", "yarn.lock", "pnpm-lock.yaml", "bun.lock", "bun.lockb"]);
|
|
133164
|
+
__name(splitManifests, "splitManifests");
|
|
133182
133165
|
__name(undeployedChanges, "undeployedChanges");
|
|
133183
133166
|
__name(classifyData, "classifyData");
|
|
133184
133167
|
AppTest = class _AppTest {
|
|
@@ -133243,6 +133226,12 @@ var init_app_test = __esm({
|
|
|
133243
133226
|
const target = control.target;
|
|
133244
133227
|
if ((options2.undeployed ?? "refuse") === "refuse") {
|
|
133245
133228
|
const local = undeployedChanges(root, projectId, preview);
|
|
133229
|
+
const { app: changedApp, manifests } = splitManifests(local?.changed ?? []);
|
|
133230
|
+
if (local && manifests.length) {
|
|
133231
|
+
local.changed = changedApp;
|
|
133232
|
+
process.stderr.write(`Note: ${manifests.join(", ")} changed since the last ${preview ? "preview save" : "deploy"}. Installing test tools changes only these, so the tests run; if you changed the app's dependencies, ${preview ? "save the preview" : "deploy"} first.
|
|
133233
|
+
`);
|
|
133234
|
+
}
|
|
133246
133235
|
if (local?.changed.length) {
|
|
133247
133236
|
throw new Error(preview ? `This folder has changes its preview does not have (${local.changed.slice(0, 8).join(", ")}${local.changed.length > 8 ? ", \u2026" : ""}). Save them with \`somewhere preview\`, then run this script.` : `This folder has changes the live release does not have (${local.changed.slice(0, 8).join(", ")}${local.changed.length > 8 ? ", \u2026" : ""}). The last deploy did not publish them (it failed, was refused, or has not run), so testing now would test an old release. Deploy, check that it succeeded, then run this script.`);
|
|
133248
133237
|
}
|
|
@@ -133373,10 +133362,6 @@ var init_app_test = __esm({
|
|
|
133373
133362
|
this.checks.push({ name, ok: true, ms: Math.round(performance.now() - start) });
|
|
133374
133363
|
return true;
|
|
133375
133364
|
} catch (error3) {
|
|
133376
|
-
if (error3 instanceof TestInboxNeedsClaim) {
|
|
133377
|
-
this.checks.push({ name, ok: false, ms: 0, skipped: "needs-claim", error: error3.message });
|
|
133378
|
-
return false;
|
|
133379
|
-
}
|
|
133380
133365
|
await this.rememberPageSecrets();
|
|
133381
133366
|
const pages = await Promise.all([...this.host.pages].map(pageState));
|
|
133382
133367
|
const stopped = [...this.host.pages].map((page) => browserStoppedMessage(page, error3)).find(Boolean);
|
|
@@ -133390,7 +133375,7 @@ page ${i + 1}: ${state}`).join("");
|
|
|
133390
133375
|
}
|
|
133391
133376
|
}
|
|
133392
133377
|
/** Confirm the release did not change, delete this script's sign-up accounts by exact id, write
|
|
133393
|
-
* the result once, print one summary, and set a non-zero exit code if anything failed. */
|
|
133378
|
+
* the result once, print one summary, and set a non-zero exit code if anything failed or was skipped. */
|
|
133394
133379
|
async finish() {
|
|
133395
133380
|
if (this.finished)
|
|
133396
133381
|
throw new Error("finish() already ran");
|
|
@@ -133473,7 +133458,7 @@ page ${i + 1}: ${state}`).join("");
|
|
|
133473
133458
|
if (live !== this.release) {
|
|
133474
133459
|
process.stdout.write(preview ? "The preview changed or closed during this script. Save it again with `somewhere preview` (or open a new one if it closed), then run the whole script again.\n" : "The live release changed during this script. Run the whole script again.\n");
|
|
133475
133460
|
}
|
|
133476
|
-
if (failed || !this.checks.length)
|
|
133461
|
+
if (failed || !this.checks.length || this.checks.some((check2) => check2.skipped))
|
|
133477
133462
|
process.exitCode = 1;
|
|
133478
133463
|
return { passed, failed, file: this.resultsPath };
|
|
133479
133464
|
}
|
|
@@ -133565,15 +133550,6 @@ function runner() {
|
|
|
133565
133550
|
} catch {
|
|
133566
133551
|
throw new Error("Install project test dependencies: npm install -D @playwright/test @somewhere-cloud/cli");
|
|
133567
133552
|
}
|
|
133568
|
-
const withInboxSkip = /* @__PURE__ */ __name(async (work) => {
|
|
133569
|
-
try {
|
|
133570
|
-
return await work();
|
|
133571
|
-
} catch (error3) {
|
|
133572
|
-
if (error3 instanceof TestInboxNeedsClaim)
|
|
133573
|
-
pw.test.skip(true, error3.message);
|
|
133574
|
-
throw error3;
|
|
133575
|
-
}
|
|
133576
|
-
}, "withInboxSkip");
|
|
133577
133553
|
const test2 = pw.test.extend({
|
|
133578
133554
|
_preview: [async ({}, use) => {
|
|
133579
133555
|
const control = await previewControlForWorker();
|
|
@@ -133755,13 +133731,13 @@ function runner() {
|
|
|
133755
133731
|
}
|
|
133756
133732
|
}, "_forms"),
|
|
133757
133733
|
signUp: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
|
|
133758
|
-
await use((page, options2) => span("signUp", { test: titled(info2.project.name, info2.title) }, () =>
|
|
133734
|
+
await use((page, options2) => span("signUp", { test: titled(info2.project.name, info2.title) }, () => signUp(_forms, page, options2 ?? {})));
|
|
133759
133735
|
}, "signUp"),
|
|
133760
133736
|
verify: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
|
|
133761
|
-
await use((page, person) => span("verify", { test: titled(info2.project.name, info2.title) }, () =>
|
|
133737
|
+
await use((page, person) => span("verify", { test: titled(info2.project.name, info2.title) }, () => verify(_forms, page, person)));
|
|
133762
133738
|
}, "verify"),
|
|
133763
133739
|
signIn: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
|
|
133764
|
-
await use((page, person, options2) => span("signIn", { test: titled(info2.project.name, info2.title) }, () =>
|
|
133740
|
+
await use((page, person, options2) => span("signIn", { test: titled(info2.project.name, info2.title) }, () => signIn(_forms, page, person, options2 ?? {})));
|
|
133765
133741
|
}, "signIn"),
|
|
133766
133742
|
signOut: /* @__PURE__ */ __name(async ({ _forms }, use, info2) => {
|
|
133767
133743
|
await use((page, options2) => span("signOut", { test: titled(info2.project.name, info2.title) }, () => signOut(_forms, page, options2 ?? {})));
|