Skip to content

Commit 2bd04dd

Browse files
fix(workflows-shared): reduce test flakiness on Windows CI
The workflows-shared vitest config was not extending the monorepo-wide vitest.shared.ts, so tests ran with vitest's default 5s test timeout (vs the shared 50s) and zero retries. Combined with tight vi.waitUntil polling timeouts (500-1000ms), this caused consistent failures on slow Windows CI runners. - Merge vitest.shared.ts into workflows-shared vitest config (adds testTimeout: 50s, retry: 2, restoreMocks: true) - Raise waitUntilLogEvent helper default timeout from 1s to 5s - Fix bare-number vi.waitUntil(cb, 500) calls to use { timeout: 5000 } - Bump all vi.waitUntil polling timeouts from 500-3000ms to 5000ms (preserving deliberate step.waitForEvent timeouts that test workflow timeout semantics)
1 parent 5535ffc commit 2bd04dd

4 files changed

Lines changed: 87 additions & 71 deletions

File tree

packages/workflows-shared/tests/binding.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ function createBinding(): WorkflowBinding {
2424
async function waitUntilLogEvent(
2525
engineStub: DurableObjectStub<Engine>,
2626
event: InstanceEvent,
27-
timeout = 1000
27+
timeout = 5000
2828
): Promise<void> {
2929
await vi.waitUntil(
3030
async () => {
@@ -77,7 +77,7 @@ describe("WorkflowBinding", () => {
7777
const s = await instance.status();
7878
return s.status === "complete";
7979
},
80-
{ timeout: 1000 }
80+
{ timeout: 5000 }
8181
);
8282
});
8383

@@ -120,7 +120,7 @@ describe("WorkflowBinding", () => {
120120
const s = await instance.status();
121121
return s.status === "complete";
122122
},
123-
{ timeout: 1000 }
123+
{ timeout: 5000 }
124124
);
125125
});
126126
});
@@ -150,7 +150,7 @@ describe("WorkflowBinding", () => {
150150
const s = await instance.status();
151151
return s.status === "complete";
152152
},
153-
{ timeout: 1000 }
153+
{ timeout: 5000 }
154154
);
155155
}
156156
});
@@ -209,7 +209,7 @@ describe("WorkflowBinding", () => {
209209
const status = await instance.status();
210210
return status.status === "complete";
211211
},
212-
{ timeout: 1000 }
212+
{ timeout: 5000 }
213213
);
214214

215215
expect(disposeSpy).not.toHaveBeenCalled();
@@ -386,7 +386,7 @@ describe("WorkflowHandle", () => {
386386
const status = await instance.status();
387387
return status.status === "complete";
388388
},
389-
{ timeout: 1000 }
389+
{ timeout: 5000 }
390390
);
391391

392392
const status = await instance.status();
@@ -431,7 +431,7 @@ describe("WorkflowHandle", () => {
431431
);
432432
return waitStarts.length === 2;
433433
},
434-
{ timeout: 1000 }
434+
{ timeout: 5000 }
435435
);
436436

437437
await instance.sendEvent({
@@ -444,7 +444,7 @@ describe("WorkflowHandle", () => {
444444
const status = await instance.status();
445445
return status.status === "complete";
446446
},
447-
{ timeout: 1000 }
447+
{ timeout: 5000 }
448448
);
449449

450450
const status = await instance.status();
@@ -531,7 +531,7 @@ describe("WorkflowHandle", () => {
531531
const s = await instance.status();
532532
return s.status === "complete";
533533
},
534-
{ timeout: 1000 }
534+
{ timeout: 5000 }
535535
);
536536

537537
// Verify second run completed
@@ -570,7 +570,7 @@ describe("WorkflowHandle", () => {
570570
const s = await instance.status();
571571
return s.status === "paused";
572572
},
573-
{ timeout: 2000 }
573+
{ timeout: 5000 }
574574
);
575575

576576
const finalStatus = await instance.status();
@@ -608,7 +608,7 @@ describe("WorkflowHandle", () => {
608608
const s = await instance.status();
609609
return s.status === "paused";
610610
},
611-
{ timeout: 2000 }
611+
{ timeout: 5000 }
612612
);
613613

614614
await instance.resume();
@@ -618,7 +618,7 @@ describe("WorkflowHandle", () => {
618618
const s = await instance.status();
619619
return s.status === "complete";
620620
},
621-
{ timeout: 3000 }
621+
{ timeout: 5000 }
622622
);
623623

624624
const finalStatus = await instance.status();
@@ -665,7 +665,7 @@ describe("WorkflowHandle", () => {
665665
const s = await instance.status();
666666
return s.status === "complete";
667667
},
668-
{ timeout: 3000 }
668+
{ timeout: 5000 }
669669
);
670670

671671
const finalStatus = await instance.status();

packages/workflows-shared/tests/context.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ describe("Context", () => {
5050
(val) => val.event === InstanceEvent.WORKFLOW_SUCCESS
5151
);
5252
},
53-
{ timeout: 1000 }
53+
{ timeout: 5000 }
5454
);
5555

5656
expect(receivedAttempt).toBe(1);
@@ -86,7 +86,7 @@ describe("Context", () => {
8686
(val) => val.event === InstanceEvent.WORKFLOW_FAILURE
8787
);
8888
},
89-
{ timeout: 1000 }
89+
{ timeout: 5000 }
9090
);
9191

9292
// Should have received attempts 1, 2, and 3
@@ -192,7 +192,7 @@ describe("Context", () => {
192192
(val) => val.event === InstanceEvent.WORKFLOW_SUCCESS
193193
);
194194
},
195-
{ timeout: 1000 }
195+
{ timeout: 5000 }
196196
);
197197

198198
expect(receivedCtx).toMatchObject({
@@ -231,7 +231,7 @@ describe("Context", () => {
231231
(val) => val.event === InstanceEvent.WORKFLOW_SUCCESS
232232
);
233233
},
234-
{ timeout: 1000 }
234+
{ timeout: 5000 }
235235
);
236236

237237
expect(receivedContexts[0]).toMatchObject({
@@ -269,7 +269,7 @@ describe("Context", () => {
269269
(val) => val.event === InstanceEvent.WORKFLOW_SUCCESS
270270
);
271271
},
272-
{ timeout: 1000 }
272+
{ timeout: 5000 }
273273
);
274274

275275
expect(receivedCtx).toMatchObject({
@@ -317,7 +317,7 @@ describe("Context", () => {
317317
(val) => val.event === InstanceEvent.WORKFLOW_SUCCESS
318318
);
319319
},
320-
{ timeout: 1000 }
320+
{ timeout: 5000 }
321321
);
322322

323323
// User overrides should be merged with defaults
@@ -369,7 +369,7 @@ describe("Context", () => {
369369
(val) => val.event === InstanceEvent.WORKFLOW_FAILURE
370370
);
371371
},
372-
{ timeout: 1000 }
372+
{ timeout: 5000 }
373373
);
374374

375375
// With limit: 1, the engine should execute attempt 1 + 1 retry = 2 attempts total.

0 commit comments

Comments
 (0)