Skip to content

Commit

Permalink
ci: extend the timeout on BundleController.test.ts "custom build" tes…
Browse files Browse the repository at this point in the history
…t to reduce CI flakiness (#7473)
  • Loading branch information
petebacondarwin authored Dec 6, 2024
1 parent 20a0f17 commit b9d4d5a
Showing 1 changed file with 43 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,47 +193,49 @@ 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
return new Response("hello custom build")
}
} satisfies ExportedHandler
`,
});
const config: Partial<StartDevWorkerOptions> = {
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<StartDevWorkerOptions> = {
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) {
Expand All @@ -242,19 +244,19 @@ 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
return new Response("hello custom build 2")
}
}
`,
});
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) {
Expand All @@ -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 }) => {
Expand Down

0 comments on commit b9d4d5a

Please sign in to comment.