test(flaky): harden slow vmFork unit suites

Co-authored-by: Ho Lim <166576253+HOYALIM@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-02-22 19:00:54 +01:00
parent 9ea5228f42
commit 2858901441
5 changed files with 22 additions and 10 deletions

View File

@@ -12,6 +12,7 @@ const TELEGRAM_TEST_TIMINGS = {
mediaGroupFlushMs: 20,
textFragmentGapMs: 30,
} as const;
const TELEGRAM_BOT_IMPORT_TIMEOUT_MS = process.platform === "win32" ? 180_000 : 150_000;
let createTelegramBot: typeof import("./bot.js").createTelegramBot;
let replySpy: ReturnType<typeof vi.fn>;
@@ -98,7 +99,7 @@ beforeAll(async () => {
({ createTelegramBot } = await import("./bot.js"));
const replyModule = await import("../auto-reply/reply.js");
replySpy = (replyModule as unknown as { __replySpy: ReturnType<typeof vi.fn> }).__replySpy;
});
}, TELEGRAM_BOT_IMPORT_TIMEOUT_MS);
vi.mock("./sticker-cache.js", () => ({
cacheSticker: (...args: unknown[]) => cacheStickerSpy(...args),