You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
No production/PII data in tests — anonymize or synthesize (per SDP §Test Data Protection)
Commands
npm run test# Unit tests (watch)
npm run coverage # With coverage report
npm run test:ci # CI mode, JUnit XML
npm run test:e2e # Cypress E2E
npm run test:e2e:ci # Headless Cypress for CI
npm run lint # ESLint
Existing Test Patterns
File
Pattern
src/App.test.tsx
Root component with Three.js mocks
src/components/GameScene.test.tsx
3D component testing
src/hooks/useGameState.movement.test.ts
renderHook + act
src/utils/gameConfig.test.ts
Pure function testing
src/test/setup.ts
Global mocks, jsdom config
cypress/e2e/
E2E flows
Decision Frameworks
Test type: pure function → Vitest unit. Component → RTL + Vitest. User flow → Cypress E2E
Mocking: time → vi.useFakeTimers(). RNG → vi.spyOn(Math, 'random') with fixed sequence. Three.js → vi.mock('@react-three/fiber', …)
Test Data Protection — no production data ever in tests; anonymize/synthesize
Remember
Build deterministic, fast, behavior-focused tests with ≥ 80 % coverage overall and ≥ 95 % on security code. Mock Three.js for unit tests; cover game interactions via Cypress. Apply the testing-strategy skill. Escalate security-test design to security-specialist.