fix(ci): stop channel timers holding vitest open

This commit is contained in:
Peter Steinberger
2026-05-31 02:33:38 -04:00
parent deb7bc6539
commit 9c3cf35e08
3 changed files with 11 additions and 1 deletions
+9 -1
View File
@@ -1,4 +1,4 @@
import { describe, expect, it, vi } from "vitest";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { MAX_TIMER_TIMEOUT_MS } from "../shared/number-coercion.js";
import { createDraftStreamLoop } from "./draft-stream-loop.js";
@@ -29,6 +29,14 @@ async function captureUnhandledRejections(
}
describe("createDraftStreamLoop", () => {
beforeEach(() => {
vi.useRealTimers();
});
afterEach(() => {
vi.useRealTimers();
});
it("contains immediate background flush rejections and preserves pending text", async () => {
await captureUnhandledRejections(async (rejections) => {
const error = new Error("send failed");
+1
View File
@@ -33,6 +33,7 @@ export function createTypingKeepaliveLoop(params: {
timer = setInterval(() => {
void tick();
}, params.intervalMs);
timer.unref?.();
};
const stop = () => {
+1
View File
@@ -76,6 +76,7 @@ export function createTypingCallbacks(params: CreateTypingCallbacksParams): Typi
fireStop();
}
}, maxDurationMs);
ttlTimer.unref?.();
};
const clearTtlTimer = () => {