test(ci): consolidate project deadline policy checks (#12777)

This commit is contained in:
morluto authored and GitHub committed 2026-11-20 12:32:19 +00:00
1 parent d1275f72d6
commit ec533c6e64
2 files changed
+16 -17

No files matched your search

@@ -152,7 +152,7 @@ describe("Vitest project configuration", () => {
processTest.for(
[
{ flags: [], timeout: 30_000, lines: 68 },
{ flags: [], timeout: 30_000, lines: 68, alsoHosted: true },
{ flags: ["--coverage"], timeout: 60_000, lines: 68 },
{ flags: ["--coverage.enabled"], timeout: 60_000, lines: 68 },
{ flags: ["--coverage=false"], timeout: 30_000, lines: 68 },
@@ -170,19 +170,20 @@ describe("Vitest project configuration", () => {
flags: ["--coverage.enabled", "--shard", "1/6"],
timeout: 60_000,
lines: 0,
alsoHosted: true,
},
{
flags: ["--coverage.enabled=false", "--shard=1/6"],
timeout: 30_000,
lines: 0,
},
].flatMap((policy) =>
// Hosted CI owns a four-core runner: up to four workers, doubled deadlines.
[
{ ...policy, hosted: false, workers: 2, scale: 1 },
{ ...policy, hosted: true, workers: 4, scale: 2 },
],
),
].flatMap(({ alsoHosted, ...policy }) => [
{ ...policy, hosted: false, workers: 2, scale: 1 },
// Check hosted scaling with coverage both off and on.
...(alsoHosted
? [{ ...policy, hosted: true, workers: 4, scale: 2 }]
: []),
]),
)(
"resolves worker resources from actual CLI options: $flags (hosted: $hosted)",
async (
+7 -9
View File
@@ -30,14 +30,12 @@ it("derives a wait or child deadline from the test deadline, keeping a reporting
expect(remainingTestDeadline(0, 0)).toBeUndefined();
});
it("bounds expect.poll by the project deadline", async () => {
it("bounds both wait helpers by the project deadline", async () => {
const ready = performance.now() + PAST_VITEST_WAIT_DEFAULT_MS;
await expect.poll(() => performance.now() >= ready).toBe(true);
});
it("bounds waitFor by its test's deadline", async () => {
const ready = performance.now() + PAST_VITEST_WAIT_DEFAULT_MS;
await waitFor(() => {
if (performance.now() < ready) throw new Error("not ready yet");
});
await Promise.all([
expect.poll(() => performance.now() >= ready).toBe(true),
waitFor(() => {
if (performance.now() < ready) throw new Error("not ready yet");
}),
]);
});