From 2384560dd4588c52abd37ad3651fb41216b8b8ae Mon Sep 17 00:00:00 2001 From: Rahul Sethi <5822355+RamIdeas@users.noreply.github.com> Date: Thu, 26 Sep 2024 12:13:04 +0100 Subject: [PATCH] fix version preview url snapshot (#6833) --- packages/wrangler/e2e/helpers/normalize.ts | 7 +++++++ packages/wrangler/e2e/versions.test.ts | 3 +++ 2 files changed, 10 insertions(+) diff --git a/packages/wrangler/e2e/helpers/normalize.ts b/packages/wrangler/e2e/helpers/normalize.ts index 2914109ff0c3..6c0f1bffbe53 100644 --- a/packages/wrangler/e2e/helpers/normalize.ts +++ b/packages/wrangler/e2e/helpers/normalize.ts @@ -9,6 +9,7 @@ export function normalizeOutput( removeStandardPricingWarning, npmStripTimings, removeWorkersDev, + removeWorkerPreviewUrl, removeUUID, normalizeErrorMarkers, replaceByte, @@ -43,6 +44,12 @@ function stripDevTimings(stdout: string): string { return stdout.replace(/\(\dms\)/g, "(TIMINGS)"); } +function removeWorkerPreviewUrl(str: string) { + return str.replace( + /https:\/\/(?[a-f\d]+)-(?.+)-(?\w{8}-\w{4}-\w{4}-\w{4}-\w{12})\..+?\.workers\.dev/g, + "https://$2-PREVIEW-URL.SUBDOMAIN.workers.dev" + ); +} function removeWorkersDev(str: string) { return str.replace( /https:\/\/(.+?)\..+?\.workers\.dev/g, diff --git a/packages/wrangler/e2e/versions.test.ts b/packages/wrangler/e2e/versions.test.ts index fd9efd1149a6..3ae5e3e8967e 100644 --- a/packages/wrangler/e2e/versions.test.ts +++ b/packages/wrangler/e2e/versions.test.ts @@ -63,6 +63,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Worker Startup Time: (TIMINGS) Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS) Worker Version ID: 00000000-0000-0000-0000-000000000000 + Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev To deploy this version to production traffic use the command wrangler versions deploy Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy" @@ -178,6 +179,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Worker Startup Time: (TIMINGS) Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS) Worker Version ID: 00000000-0000-0000-0000-000000000000 + Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev To deploy this version to production traffic use the command wrangler versions deploy Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy" @@ -623,6 +625,7 @@ describe("versions deploy", { timeout: TIMEOUT }, () => { Worker Startup Time: (TIMINGS) Uploaded tmp-e2e-worker-00000000-0000-0000-0000-000000000000 (TIMINGS) Worker Version ID: 00000000-0000-0000-0000-000000000000 + Version Preview URL: https://tmp-e2e-worker-PREVIEW-URL.SUBDOMAIN.workers.dev To deploy this version to production traffic use the command wrangler versions deploy Changes to non-versioned settings (config properties 'logpush' or 'tail_consumers') take effect after your next deployment using the command wrangler versions deploy Changes to triggers (routes, custom domains, cron schedules, etc) must be applied with the command wrangler triggers deploy"