no-first-party-module-mock
Prefer injected collaborators over mocking maintained first-party modules in tests.
Why
Replacing an owned module couples tests to its lookup path and can verify mock wiring while bypassing the real implementation contract.
Fix
Extract a narrow port or pure core operation and inject a typed fake; retain module mocking only when module lookup or bootstrap behavior is the contract.
Examples
import { vi } from "vitest";vi.mock("./service", () => ({ run: vi.fn() }));const result = await runAction({ service: recordingService });