TypeScript testing best practices for TypeScript 5.x: choosing between Vitest and Jest, the Arrange-Act-Assert structure, type-level testing with expectTypeOf and tsd, mocking with vi.mock / jest.mock and module mocks, async testing, coverage with v8 (c8) or istanbul, and pointers to component and E2E testing. Use when writing or improving TypeScript tests, setting up a test runner, or asserting on types.