Skip to content

Commit

Permalink
fix: pages project delete should error if project name not specified (
Browse files Browse the repository at this point in the history
#6914)

* fix pages project delete demandOption

* test
  • Loading branch information
emily-shen authored Oct 10, 2024
1 parent 301d413 commit a24c86b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions packages/wrangler/src/__tests__/pages/project-delete.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ describe("pages project delete", () => {
`);
});

it("should error if no project name is specified", async () => {
await expect(
runWrangler("pages project delete")
).rejects.toThrowErrorMatchingInlineSnapshot(
`[Error: Missing required argument: project-name]`
);
});

it("should not delete a project if confirmation refused", async () => {
mockConfirm({
text: `Are you sure you want to delete "some-project-name-2"? This action cannot be undone.`,
Expand Down
4 changes: 2 additions & 2 deletions packages/wrangler/src/pages/projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ export function DeleteOptions(yargs: CommonYargsArgv) {
return yargs
.positional("project-name", {
type: "string",
demandOption: true,
description: "The name of your Pages project",
})
.options({
Expand All @@ -197,7 +196,8 @@ export function DeleteOptions(yargs: CommonYargsArgv) {
type: "boolean",
description: 'Answer "yes" to confirm project deletion',
},
});
})
.demandOption("project-name");
}

export async function DeleteHandler(
Expand Down

0 comments on commit a24c86b

Please sign in to comment.