- One fake per seam, installed once. A web test no longer writes
vi.mock("@/platform/rpc/orpc", …)with a hand-builtorpcobject.apps/web/src/test-setup.tsinstalls@/testing/fake-orpc,@/testing/fake-session-queryand@/testing/fake-auth-clientfor every test file, and a test programs them:rpc.todo.stats.mockResolvedValue(stats),seedSession(queryClient, session),fakeAuth.signOut.mockResolvedValue(…). See testing. (#254) - The fake oRPC client is typed and runs the real query utils.
rpcis typed by the app router, so an answer with the wrong shape failspnpm check-types, andorpcis the realcreateTanstackQueryUtilsover it, so query keys and inputs are the production ones. A procedure that no test programmed rejects by name. (#254) vi.mockcounts only shrink.scripts/web-mock-targets.test.mjs(inpnpm test) holds a baseline per mocked module. Web tests went from 94vi.mockcalls to 55; seven test files still stub a seam by hand and are listed in #253. (#254)
Web tests fake the server seams once
The session query, the auth client and the oRPC client each have one fake that every web test gets from the test setup. A new typed fake oRPC client runs the real TanStack Query utils, and a ratchet keeps vi.mock counts from growing.
Edit on GitHubDocumentation is in English.