Skip to content

Commit 8e3688f

Browse files
authored
fix: include asset binding when printing binding summary (#8435)
1 parent f043b74 commit 8e3688f

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

.changeset/chatty-rockets-call.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
fix: include assets binding when printing summary of bindings

packages/wrangler/e2e/deployments.test.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ describe.each([
247247
flags: "",
248248
async beforeAll() {},
249249
async afterAll() {},
250-
expectInitialStdout: (output: string) => {
250+
expectAssetsOnlyStdout: (output: string) => {
251251
expect(output).toEqual(`🌀 Building list of assets...
252252
🌀 Starting asset upload...
253253
🌀 Found 3 new or modified static assets to upload. Proceeding with upload...
@@ -265,7 +265,7 @@ Deployed tmp-e2e-worker-00000000-0000-0000-0000-000000000000 triggers (TIMINGS)
265265
https://tmp-e2e-worker-00000000-0000-0000-0000-000000000000.SUBDOMAIN.workers.dev
266266
Current Version ID: 00000000-0000-0000-0000-000000000000`);
267267
},
268-
expectSubsequentStdout: (output: string) => {
268+
expectWithWorkerStdout: (output: string) => {
269269
expect(output).toContain(`🌀 Building list of assets...
270270
🌀 Starting asset upload...`);
271271
// Unfortunately the server-side deduping logic isn't always 100% accurate, and sometimes a file is re-uploaded
@@ -321,7 +321,7 @@ Current Version ID: 00000000-0000-0000-0000-000000000000`);
321321
`wrangler dispatch-namespace delete ${dispatchNamespaceName}`
322322
);
323323
},
324-
expectInitialStdout: (output: string) => {
324+
expectAssetsOnlyStdout: (output: string) => {
325325
expect(output).toEqual(`🌀 Building list of assets...
326326
🌀 Starting asset upload...
327327
🌀 Found 3 new or modified static assets to upload. Proceeding with upload...
@@ -338,7 +338,7 @@ Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS)
338338
Dispatch Namespace: tmp-e2e-dispatch-00000000-0000-0000-0000-000000000000
339339
Current Version ID: 00000000-0000-0000-0000-000000000000`);
340340
},
341-
expectSubsequentStdout: (output: string) => {
341+
expectWithWorkerStdout: (output: string) => {
342342
expect(output).toContain(`🌀 Building list of assets...
343343
🌀 Starting asset upload...`);
344344
// Unfortunately the server-side deduping logic isn't always 100% accurate, and sometimes a file is re-uploaded
@@ -350,6 +350,7 @@ Current Version ID: 00000000-0000-0000-0000-000000000000`);
350350
"No files to upload.",
351351
].some((s) => output.includes(s))
352352
).toBeTruthy();
353+
expect(output).toContain("- Binding: ASSETS");
353354
},
354355
},
355356
])("Workers + Assets deployment: $name", { timeout: TIMEOUT }, (testcase) => {
@@ -373,7 +374,7 @@ Current Version ID: 00000000-0000-0000-0000-000000000000`);
373374
});
374375

375376
const output = await helper.run(`wrangler deploy ${testcase.flags}`);
376-
testcase.expectInitialStdout(normalize(output.stdout));
377+
testcase.expectAssetsOnlyStdout(normalize(output.stdout));
377378
if (testcase.url) {
378379
deployedUrl = testcase.url;
379380
} else {
@@ -444,7 +445,7 @@ Current Version ID: 00000000-0000-0000-0000-000000000000`);
444445
});
445446
const output = await helper.run(`wrangler deploy ${testcase.flags}`);
446447
// expect only no asset files to be uploaded as no new asset files have been added
447-
testcase.expectSubsequentStdout(normalize(output.stdout));
448+
testcase.expectWithWorkerStdout(normalize(output.stdout));
448449
if (!deployedUrl) {
449450
const match = output.stdout.match(
450451
/(?<url>https:\/\/tmp-e2e-.+?\..+?\.workers\.dev)/
@@ -510,7 +511,7 @@ Current Version ID: 00000000-0000-0000-0000-000000000000`);
510511

511512
const output = await helper.run(`wrangler deploy ${testcase.flags}`);
512513
// expect only no asset files to be uploaded as no new asset files have been added
513-
testcase.expectSubsequentStdout(normalize(output.stdout));
514+
testcase.expectWithWorkerStdout(normalize(output.stdout));
514515
if (!deployedUrl) {
515516
const match = output.stdout.match(
516517
/(?<url>https:\/\/tmp-e2e-.+?\..+?\.workers\.dev)/

packages/wrangler/src/utils/print-bindings.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ export function printBindings(
9393
dispatch_namespaces,
9494
mtls_certificates,
9595
pipelines,
96+
assets,
9697
} = bindings;
9798

9899
if (data_blobs !== undefined && Object.keys(data_blobs).length > 0) {
@@ -394,6 +395,13 @@ export function printBindings(
394395
});
395396
}
396397

398+
if (assets !== undefined) {
399+
output.push({
400+
name: friendlyBindingNames.assets,
401+
entries: [{ key: "Binding", value: assets.binding }],
402+
});
403+
}
404+
397405
if (version_metadata !== undefined) {
398406
output.push({
399407
name: friendlyBindingNames.version_metadata,

0 commit comments

Comments
 (0)