Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/bumpy-schools-sniff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: skip banner when using `--json` flag in `wrangler pages deployment` commands
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { runWrangler } from "./../helpers/run-wrangler";
import type { Deployment } from "./../../pages/types";

describe("pages deployment list", () => {
vi.unmock("../../wrangler-banner");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should unmock print banner across all the tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. That's my plan next after all these PRs. It's really tricky to catch this when we have it mocked by default, especially when the command is done by external team.

But it would probably be a huge PR as it will likely impact a fair amount of snapshots test we had.

runInTempDir();
mockAccountId();
mockApiToken();
Expand Down Expand Up @@ -47,7 +48,10 @@ describe("pages deployment list", () => {

expect(requests.count).toBe(1);
expect(std.out).toMatchInlineSnapshot(`
"┌─┬─┬─┬─┬─┬─┬─┐
"
⛅️ wrangler x.x.x
──────────────────
┌─┬─┬─┬─┬─┬─┬─┐
│ Id │ Environment │ Branch │ Source │ Deployment │ Status │ Build │
├─┼─┼─┼─┼─┼─┼─┤
│ 87bbc8fe-16be-45cd-81e0-63d722e82cdf │ Preview │ main │ c764936 │ https://87bbc8fe.images.pages.dev │ 3 years ago │ https://dash.cloudflare.com/some-account-id/pages/view/images/87bbc8fe-16be-45cd-81e0-63d722e82cdf │
Expand Down
1 change: 1 addition & 0 deletions packages/wrangler/src/pages/deployments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const pagesDeploymentListCommand = createCommand({
},
behaviour: {
provideConfig: false,
printBanner: (args) => !args.json,
},
args: {
"project-name": {
Expand Down
2 changes: 1 addition & 1 deletion packages/wrangler/src/versions/deployments/list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const deploymentsListCommand = createCommand({
},
},
behaviour: {
printBanner: false,
printBanner: (args) => !args.json,
},
handler: async function versionsDeploymentsListHandler(args, { config }) {
metrics.sendMetricsEvent(
Expand Down
7 changes: 1 addition & 6 deletions packages/wrangler/src/versions/deployments/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { UserError } from "../../errors";
import * as metrics from "../../metrics";
import { requireAuth } from "../../user";
import formatLabelledValues from "../../utils/render-labelled-values";
import { printWranglerBanner } from "../../wrangler-banner";
import { fetchLatestDeployment, fetchVersions } from "../api";
import { getDeploymentSource } from "./list";
import type { VersionCache } from "../types";
Expand All @@ -32,13 +31,9 @@ export const deploymentsStatusCommand = createCommand({
},
},
behaviour: {
printBanner: false,
printBanner: (args) => !args.json,
},
handler: async function versionsDeploymentsStatusHandler(args, { config }) {
if (!args.json) {
await printWranglerBanner();
}

metrics.sendMetricsEvent(
"view latest versioned deployment",
{},
Expand Down
Loading