--- description: Testing philosophy, Vitest/Playwright, coverage, and mocking alwaysApply: true --- Testing standards and tooling for the project. ## Testing philosophy - Every meaningful code change should include appropriate test coverage. - New files, functions, and methods should receive comprehensive test coverage where relevant. - Definition of done includes tests passing. ## Required test layers Use the appropriate mix of: - unit tests - integration tests - component tests - e2e tests where relevant ## Tooling defaults - Use Vitest for unit and integration testing unless explicitly directed otherwise. - Use Playwright for end-to-end testing. - Use Testing Library patterns for UI/component tests where appropriate. ## Coverage expectations - Maintain a minimum of 85% coverage per app/package. - Coverage should include: - happy paths - edge cases - error cases ## Mocking standards - Do not create duplicate mocks. - Prefer centralized, reusable mocks, fixtures, and test factories. - Integration tests should prefer realistic boundaries and minimal mocking. - Unit tests may use mocks where appropriate, but shared mocks should be reused rather than redefined ad hoc. ## Quality standards - Tests should be readable, deterministic, and isolated. - Avoid brittle tests coupled to implementation details. - Temporary test omissions are allowed only when explicitly acknowledged, but the work is not complete until the full test expectation is satisfied. - Where practical, include accessibility-oriented testing for components and flows.