From 2e06a235b4ce992c35e37d015f3c8ebf4e1194b6 Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Wed, 15 Nov 2023 16:27:09 +0000 Subject: [PATCH] ci: clean up C3 e2e test projects according to their type Previously we only deleted Pages projects - in fact we were trying to delete the Hono (non-Pages) Worker as a Pages project. Now we delete the project based on its type. --- .../e2e-tests/{pages.test.ts => frameworks.test.ts} | 12 ++++++------ packages/create-cloudflare/scripts/common.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) rename packages/create-cloudflare/e2e-tests/{pages.test.ts => frameworks.test.ts} (96%) diff --git a/packages/create-cloudflare/e2e-tests/pages.test.ts b/packages/create-cloudflare/e2e-tests/frameworks.test.ts similarity index 96% rename from packages/create-cloudflare/e2e-tests/pages.test.ts rename to packages/create-cloudflare/e2e-tests/frameworks.test.ts index ffeb9c99d262..cd08b27cf3c5 100644 --- a/packages/create-cloudflare/e2e-tests/pages.test.ts +++ b/packages/create-cloudflare/e2e-tests/frameworks.test.ts @@ -10,7 +10,7 @@ import { beforeEach, beforeAll, } from "vitest"; -import { deleteProject } from "../scripts/common"; +import { deleteProject, deleteWorker } from "../scripts/common"; import { frameworkToTest } from "./frameworkToTest"; import { isQuarantineMode, @@ -160,13 +160,13 @@ describe.concurrent(`E2E: Web frameworks`, () => { afterEach(async (ctx) => { const framework = ctx.meta.name; clean(framework); - // Cleanup the pages project in case we need to retry it + // Cleanup the project in case we need to retry it const projectName = getName(framework); - try { + const frameworkConfig = FrameworkMap[framework]; + if (frameworkConfig.type !== "workers") { await deleteProject(projectName); - } catch (error) { - console.error(`Failed to cleanup project: ${projectName}`); - console.error(error); + } else { + await deleteWorker(projectName); } }); diff --git a/packages/create-cloudflare/scripts/common.ts b/packages/create-cloudflare/scripts/common.ts index 14673b56aeab..99b822cdd2d2 100644 --- a/packages/create-cloudflare/scripts/common.ts +++ b/packages/create-cloudflare/scripts/common.ts @@ -31,7 +31,7 @@ const apiFetch = async ( }); if (response.status >= 400) { - console.error(`REQUEST ERROR: ${url}`); + console.error(`REQUEST ERROR: ${url}`, init); console.error(`(${response.status}) ${response.statusText}`); const body = (await response.json()) as ApiErrorBody; console.error(body.errors);