This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
- less than 100% coverage is not acceptable
- coverage thresholds are enforced at 100% for all metrics (branches, functions, lines, statements) in jest.config.js
- use
npm run test:coverageto check coverage - use
npm run test:watchto run tests in watch mode during development
When coverage targets cannot be achieved through traditional testing approaches:
- Refactor complex logic into helper functions - Extract problematic lines from React components into pure helper functions
- Helper functions achieve 100% coverage easily - Pure functions with predictable inputs/outputs are inherently testable
- Focus on separation of concerns - Move business logic out of UI components into dedicated helper files
- Prefer unit testing of helpers over complex component mocking - Helper functions can be tested in isolation without React timing issues
This approach has proven successful in achieving 99%+ coverage by moving untestable React component logic into testable pure functions.
npm test- run all testsnpm run test:watch- run tests in watch modenpm run test:coverage- run tests with coverage report
npm run dev- start both Vite dev server and Electron concurrentlynpm run dev:vite- start Vite dev server only (React app at localhost:5173)npm run dev:electron- start Electron only (requires Vite server running)
npm run build- build React app for productionnpm run package- package Electron appnpm run make- create distribution packages
- main process:
src/electron/main.js- Electron main process entry point - preload script:
src/electron/preload.js- secure bridge between main and renderer - react app:
src/react/- renderer process (UI)
- routing: centralized in
src/react/routes.tsxwith type-safe route definitions - components: organized by purpose (common/, game/, layout/, ui/)
- i18n: internationalization with react-i18next, language files in
locales/ - mocking: jest mocks in
__mocks__/for UI components and external dependencies
- shadcn/ui: component library with Button, Card, Dialog primitives
- tailwind: utility-first CSS with custom configuration
- lucide-react: icon library
- lineDestroyer: complete implementation with helper functions for testability (
LineDestroyer.tsx+LineDestroyer.helpers.tsx) - tictactoe: simple game component demonstrating component structure
- document complex features in
.doc.mdfiles with comprehensive developer-oriented documentation - documentation files should back link to README.md and be linked in README.md
- use
<fileName>.doc.mdnaming for VSCode file nesting - ALWAYS internationalise client facing text