Skip to content

Commit e985267

Browse files
authored
chore: increase miniflare waitUntil helper default timeout time (#10290)
1 parent 026b485 commit e985267

File tree

2 files changed

+20
-16
lines changed

2 files changed

+20
-16
lines changed

packages/miniflare/test/dev-registry.spec.ts

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -386,13 +386,15 @@ test("DevRegistry: fetch to module worker with node bindings", async (t) => {
386386
t.teardown(() => local.dispose());
387387

388388
const bindings = await local.getBindings<Record<string, any>>();
389-
const res = await bindings.SERVICE.fetch("http://example.com?name=World");
390389

391-
t.is(
392-
await res.text(),
393-
`Couldn\'t find a local dev session for the "default" entrypoint of service "remote-worker" to proxy to`
394-
);
395-
t.is(res.status, 503);
390+
await waitUntil(t, async (t) => {
391+
const res = await bindings.SERVICE.fetch("http://example.com?name=World");
392+
t.is(
393+
await res.text(),
394+
`Couldn\'t find a local dev session for the "default" entrypoint of service "remote-worker" to proxy to`
395+
);
396+
t.is(res.status, 503);
397+
});
396398

397399
const remote = new Miniflare({
398400
name: "remote-worker",
@@ -460,15 +462,17 @@ test("DevRegistry: RPC to default entrypoint with node bindings", async (t) => {
460462

461463
const env = await local.getBindings<Record<string, any>>();
462464

463-
try {
464-
const result = await env.SERVICE.ping();
465-
t.fail(`Expected error, got result: ${result}`);
466-
} catch (e) {
467-
t.is(
468-
e instanceof Error ? e.message : `${e}`,
469-
`Cannot access "ping" as we couldn\'t find a local dev session for the "default" entrypoint of service "remote-worker" to proxy to.`
470-
);
471-
}
465+
await waitUntil(t, async (t) => {
466+
try {
467+
const result = await env.SERVICE.ping();
468+
t.fail(`Expected error, got result: ${result}`);
469+
} catch (e) {
470+
t.is(
471+
e instanceof Error ? e.message : `${e}`,
472+
`Cannot access "ping" as we couldn\'t find a local dev session for the "default" entrypoint of service "remote-worker" to proxy to.`
473+
);
474+
}
475+
});
472476

473477
const remote = new Miniflare({
474478
name: "remote-worker",

packages/miniflare/test/test-shared/asserts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export async function waitFor<T>(
6666
export async function waitUntil(
6767
t: ExecutionContext,
6868
impl: (t: ExecutionContext) => Awaitable<void>,
69-
timeout: number = 5000
69+
timeout: number = 10000
7070
): Promise<void> {
7171
const start = Date.now();
7272

0 commit comments

Comments
 (0)