import "@testing-library/jest-dom/vitest"; import { vi } from "vitest"; vi.mock("@tauri-apps/api/event", async () => { const { listenMock } = await import("./tauriEvent"); return { listen: listenMock }; }); import { cleanup } from "@testing-library/react"; import { afterEach } from "vitest"; import { resetTauriEvent } from "./tauriEvent"; afterEach(() => { cleanup(); // The registry is plain module state, so `clearMocks` does not reach it. // Without this, listeners leak across test files. resetTauriEvent(); });