Skip to content

Commit b9d4d5a

Browse files
ci: extend the timeout on BundleController.test.ts "custom build" test to reduce CI flakiness (#7473)
1 parent 20a0f17 commit b9d4d5a

File tree

1 file changed

+43
-38
lines changed

1 file changed

+43
-38
lines changed

packages/wrangler/src/__tests__/api/startDevWorker/BundleController.test.ts

Lines changed: 43 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -193,47 +193,49 @@ describe("BundleController", () => {
193193
`);
194194
});
195195

196-
test("custom build", async ({ controller }) => {
197-
await seed({
198-
"random_dir/index.ts": dedent/* javascript */ `
196+
test(
197+
"custom build",
198+
async ({ controller }) => {
199+
await seed({
200+
"random_dir/index.ts": dedent/* javascript */ `
199201
export default {
200202
fetch(request, env, ctx) {
201203
//comment
202204
return new Response("hello custom build")
203205
}
204206
} satisfies ExportedHandler
205207
`,
206-
});
207-
const config: Partial<StartDevWorkerOptions> = {
208-
legacy: {},
209-
name: "worker",
210-
entrypoint: path.resolve("out.ts"),
211-
projectRoot: path.resolve("."),
212-
build: {
213-
additionalModules: [],
214-
processEntrypoint: false,
215-
nodejsCompatMode: null,
216-
bundle: true,
217-
moduleRules: [],
218-
custom: {
219-
command: "cp random_dir/index.ts out.ts",
220-
watch: "random_dir",
208+
});
209+
const config: Partial<StartDevWorkerOptions> = {
210+
legacy: {},
211+
name: "worker",
212+
entrypoint: path.resolve("out.ts"),
213+
projectRoot: path.resolve("."),
214+
build: {
215+
additionalModules: [],
216+
processEntrypoint: false,
217+
nodejsCompatMode: null,
218+
bundle: true,
219+
moduleRules: [],
220+
custom: {
221+
command: "cp random_dir/index.ts out.ts",
222+
watch: "random_dir",
223+
},
224+
define: {},
225+
format: "modules",
226+
moduleRoot: path.resolve("."),
227+
exports: [],
221228
},
222-
define: {},
223-
format: "modules",
224-
moduleRoot: path.resolve("."),
225-
exports: [],
226-
},
227-
};
229+
};
228230

229-
await controller.onConfigUpdate({
230-
type: "configUpdate",
231-
config: configDefaults(config),
232-
});
231+
await controller.onConfigUpdate({
232+
type: "configUpdate",
233+
config: configDefaults(config),
234+
});
233235

234-
let ev = await waitForBundleComplete(controller);
235-
expect(findSourceFile(ev.bundle.entrypointSource, "out.ts"))
236-
.toMatchInlineSnapshot(`
236+
let ev = await waitForBundleComplete(controller);
237+
expect(findSourceFile(ev.bundle.entrypointSource, "out.ts"))
238+
.toMatchInlineSnapshot(`
237239
"// out.ts
238240
var out_default = {
239241
fetch(request, env, ctx) {
@@ -242,19 +244,19 @@ describe("BundleController", () => {
242244
};
243245
"
244246
`);
245-
await seed({
246-
"random_dir/index.ts": dedent/* javascript */ `
247+
await seed({
248+
"random_dir/index.ts": dedent/* javascript */ `
247249
export default {
248250
fetch(request, env, ctx) {
249251
//comment
250252
return new Response("hello custom build 2")
251253
}
252254
}
253255
`,
254-
});
255-
ev = await waitForBundleComplete(controller);
256-
expect(findSourceFile(ev.bundle.entrypointSource, "out.ts"))
257-
.toMatchInlineSnapshot(`
256+
});
257+
ev = await waitForBundleComplete(controller);
258+
expect(findSourceFile(ev.bundle.entrypointSource, "out.ts"))
259+
.toMatchInlineSnapshot(`
258260
"// out.ts
259261
var out_default = {
260262
fetch(request, env, ctx) {
@@ -263,7 +265,10 @@ describe("BundleController", () => {
263265
};
264266
"
265267
`);
266-
});
268+
},
269+
// Extend this test's timeout as it keeps flaking on CI
270+
{ timeout: 30_000 }
271+
);
267272
});
268273

269274
test("module aliasing", async ({ controller }) => {

0 commit comments

Comments
 (0)