Skip to content

Commit 504e258

Browse files
fix: Generalize autoconfig wording (#11249)
* fix: Generalize autoconfig wording * Add test for when no output directory is in the autoconfig details * update error message as suggested
1 parent 2342d2f commit 504e258

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

.changeset/salty-games-push.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
fix: Generalize autoconfig wording
6+
7+
Generalize the autoconfig wording so that when it doesn't specifically mention "deployment" (since it can be run via `wrangler setup` or the autoconfig programmatic API)

packages/wrangler/src/__tests__/autoconfig/run.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,5 +340,24 @@ describe("autoconfig (deploy)", () => {
340340
"
341341
`);
342342
});
343+
344+
it("errors if no output directory is specified in the autoconfig details", async () => {
345+
mockConfirm({
346+
text: "Do you want to modify these settings?",
347+
result: false,
348+
});
349+
350+
await expect(
351+
run.runAutoConfig({
352+
projectPath: process.cwd(),
353+
configured: false,
354+
framework: new Static("static"),
355+
workerName: "my-worker",
356+
outputDir: "",
357+
})
358+
).rejects.toThrowErrorMatchingInlineSnapshot(
359+
`[Error: Cannot configure project without an output directory]`
360+
);
361+
});
343362
});
344363
});

packages/wrangler/src/autoconfig/run.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ export async function runAutoConfig(
5959
autoConfigDetails = updatedAutoConfigDetails;
6060

6161
if (!autoConfigDetails.outputDir) {
62-
throw new FatalError("Cannot deploy project without an output directory");
62+
throw new FatalError(
63+
"Cannot configure project without an output directory"
64+
);
6365
}
6466

6567
const wranglerConfig: RawConfig = {
@@ -82,7 +84,7 @@ export async function runAutoConfig(
8284
});
8385

8486
if (!(skipConfirmations || (await confirm("Proceed with setup?")))) {
85-
throw new FatalError("Deployment aborted");
87+
throw new FatalError("Setup cancelled");
8688
}
8789

8890
if (dryRun) {

0 commit comments

Comments
 (0)