Files
wehub-resource-sync 70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:30:11 +08:00

32 lines
926 B
TypeScript

import dedent from "ts-dedent";
import { test, vitestConfig } from "./helpers";
test("waitForWaitUntil abandons promises that never resolve", async ({
expect,
seed,
vitestRun,
}) => {
await seed({
"vitest.config.mts": vitestConfig(),
"index.test.ts": dedent`
import {
setWaitUntilTimeout,
waitForWaitUntil,
} from "cloudflare:test-internal";
import { expect, it } from "vitest";
it("returns after timeout instead of hanging", async () => {
setWaitUntilTimeout(100);
const waitUntil = [new Promise(() => {})];
await waitForWaitUntil(waitUntil);
// If we get here, the timeout worked — the function didn't hang
expect(waitUntil).toHaveLength(0);
});
`,
});
const result = await vitestRun();
expect(await result.exitCode).toBe(0);
const output = result.stdout + result.stderr;
expect(output).toContain("waitUntil promise(s) did not resolve within");
});