mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(ci): stop channel timers holding vitest open
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -33,6 +33,7 @@ export function createTypingKeepaliveLoop(params: {
|
||||
timer = setInterval(() => {
|
||||
void tick();
|
||||
}, params.intervalMs);
|
||||
timer.unref?.();
|
||||
};
|
||||
|
||||
const stop = () => {
|
||||
|
||||
@@ -76,6 +76,7 @@ export function createTypingCallbacks(params: CreateTypingCallbacksParams): Typi
|
||||
fireStop();
|
||||
}
|
||||
}, maxDurationMs);
|
||||
ttlTimer.unref?.();
|
||||
};
|
||||
|
||||
const clearTtlTimer = () => {
|
||||
|
||||
Reference in New Issue
Block a user