From b9d4d5adb0ea0eb24576260549c077f577fe1eb8 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Fri, 6 Dec 2024 11:43:46 +0000 Subject: [PATCH] ci: extend the timeout on BundleController.test.ts "custom build" test to reduce CI flakiness (#7473) --- .../startDevWorker/BundleController.test.ts | 81 ++++++++++--------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/packages/wrangler/src/__tests__/api/startDevWorker/BundleController.test.ts b/packages/wrangler/src/__tests__/api/startDevWorker/BundleController.test.ts index 79f85f341437..cd142073947c 100644 --- a/packages/wrangler/src/__tests__/api/startDevWorker/BundleController.test.ts +++ b/packages/wrangler/src/__tests__/api/startDevWorker/BundleController.test.ts @@ -193,9 +193,11 @@ describe("BundleController", () => { `); }); - test("custom build", async ({ controller }) => { - await seed({ - "random_dir/index.ts": dedent/* javascript */ ` + test( + "custom build", + async ({ controller }) => { + await seed({ + "random_dir/index.ts": dedent/* javascript */ ` export default { fetch(request, env, ctx) { //comment @@ -203,37 +205,37 @@ describe("BundleController", () => { } } satisfies ExportedHandler `, - }); - const config: Partial = { - legacy: {}, - name: "worker", - entrypoint: path.resolve("out.ts"), - projectRoot: path.resolve("."), - build: { - additionalModules: [], - processEntrypoint: false, - nodejsCompatMode: null, - bundle: true, - moduleRules: [], - custom: { - command: "cp random_dir/index.ts out.ts", - watch: "random_dir", + }); + const config: Partial = { + legacy: {}, + name: "worker", + entrypoint: path.resolve("out.ts"), + projectRoot: path.resolve("."), + build: { + additionalModules: [], + processEntrypoint: false, + nodejsCompatMode: null, + bundle: true, + moduleRules: [], + custom: { + command: "cp random_dir/index.ts out.ts", + watch: "random_dir", + }, + define: {}, + format: "modules", + moduleRoot: path.resolve("."), + exports: [], }, - define: {}, - format: "modules", - moduleRoot: path.resolve("."), - exports: [], - }, - }; + }; - await controller.onConfigUpdate({ - type: "configUpdate", - config: configDefaults(config), - }); + await controller.onConfigUpdate({ + type: "configUpdate", + config: configDefaults(config), + }); - let ev = await waitForBundleComplete(controller); - expect(findSourceFile(ev.bundle.entrypointSource, "out.ts")) - .toMatchInlineSnapshot(` + let ev = await waitForBundleComplete(controller); + expect(findSourceFile(ev.bundle.entrypointSource, "out.ts")) + .toMatchInlineSnapshot(` "// out.ts var out_default = { fetch(request, env, ctx) { @@ -242,8 +244,8 @@ describe("BundleController", () => { }; " `); - await seed({ - "random_dir/index.ts": dedent/* javascript */ ` + await seed({ + "random_dir/index.ts": dedent/* javascript */ ` export default { fetch(request, env, ctx) { //comment @@ -251,10 +253,10 @@ describe("BundleController", () => { } } `, - }); - ev = await waitForBundleComplete(controller); - expect(findSourceFile(ev.bundle.entrypointSource, "out.ts")) - .toMatchInlineSnapshot(` + }); + ev = await waitForBundleComplete(controller); + expect(findSourceFile(ev.bundle.entrypointSource, "out.ts")) + .toMatchInlineSnapshot(` "// out.ts var out_default = { fetch(request, env, ctx) { @@ -263,7 +265,10 @@ describe("BundleController", () => { }; " `); - }); + }, + // Extend this test's timeout as it keeps flaking on CI + { timeout: 30_000 } + ); }); test("module aliasing", async ({ controller }) => {