Skip to content

Commit f5e62c7

Browse files
test(scripts): cover a weight that fits within the check:changed limit
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent d2b3d52 commit f5e62c7

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

‎scripts/lib/check-changed-steps.test.ts‎

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ describe("check:changed concurrency", () => {
5858

5959
it("counts a weighted task's slots and starts nothing ahead of a waiting heavy task", async () => {
6060
const limit = createLimiter(3);
61-
const gates = Array.from({ length: 3 }, () => Promise.withResolvers<void>());
61+
const gates = Array.from({ length: 5 }, () => Promise.withResolvers<void>());
6262
const started: Array<string> = [];
6363
const run = (name: string, gate: number, weight?: number) =>
6464
limit(async () => {
@@ -68,7 +68,9 @@ describe("check:changed concurrency", () => {
6868
const light = run("light", 0);
6969
// Above the limit, so it holds every slot rather than never starting.
7070
const heavy = run("heavy", 1, 5);
71-
const after = run("after", 2);
71+
const pair = run("pair", 2, 2);
72+
const beside = run("beside", 3);
73+
const last = run("last", 4);
7274
await Promise.resolve();
7375
expect(started).toEqual(["light"]);
7476

@@ -78,9 +80,14 @@ describe("check:changed concurrency", () => {
7880

7981
gates[1]!.resolve();
8082
await heavy;
81-
expect(started).toEqual(["light", "heavy", "after"]);
83+
expect(started).toEqual(["light", "heavy", "pair", "beside"]);
84+
85+
gates[3]!.resolve();
86+
await beside;
87+
expect(started).toEqual(["light", "heavy", "pair", "beside", "last"]);
8288
gates[2]!.resolve();
83-
await after;
89+
gates[4]!.resolve();
90+
await Promise.all([pair, last]);
8491
});
8592
});
8693

0 commit comments

Comments
 (0)