-
Notifications
You must be signed in to change notification settings - Fork 82
Frontend Testing
How the web app is tested. General strategy: Testing Strategy. Part of Frontend Overview.
Jest + React Testing Library. All unit tests live under src/app/__tests__/, mirroring source paths (stores/, hooks/, services/, components/, pages/, ui/, lib/, features/, …) — ~850 test files. Every Zustand store has a sibling test in __tests__/stores/.
-
jest.config.tssetscoverageProvider: 'v8', reporterstext-summary+lcov.collectCoverageFromscanssrc/**/*.{ts,tsx}and excludes.d.ts, tests, mocks, barrels,types,layout.tsx/page.tsx,constants, then re-includes three real components that happen to beindex.tsx. -
coverageThresholdis commented out — the ≥95% statements/branches/functions/lines bar is enforced by governance (AGENTS.md) and Sonar, not the Jest gate. New files must hit ≥90%. - Because the provider is v8, use
/* v8 ignore next N */(not istanbul hints) for genuinely untestable lines.
-
moduleNameMapperaliases@/(.*)→src/$1,@yosemite-crew/fhir→packages/fhir/src,@yosemite-crew/types→packages/types/src, and stubsnext/navigationwithsrc/app/jest.mocks/nextNavigation.ts. -
testEnvironment: 'jsdom',setupFilesAfterEnv: ['jest.setup.ts'].jest.setup.tsconfiguresjest-axe(WCAG 2.1 AA; contrast disabled in jsdom), polyfillsmatchMedia/IntersectionObserver/ResizeObserver/scrollTo, and turns any unexpectedconsole.warn/console.errorinto a thrown failure (so DOM-nesting warnings fail the test).
-
Zustand mocking: reset stores in
beforeEach; when a hook callsuseXxxStore.getState(), the mock must exposegetState(Object.assign(jest.fn(), { getState: jest.fn() })). -
@yosemite-crew/typesrequireActual: because the package is aliased to real source, anyjest.mock('@yosemite-crew/types')must spread...jest.requireActual('@yosemite-crew/types')or DTO mappers/enums break at load. (ESLint bansrequire()in test bodies, sorequireActualis the sanctioned escape hatch.) - Other rules: mock
react-iconsas<span>; mockaxios.isAxiosErrorvia a factory (notspyOn);Taskuses_id.
Playwright config (playwright.config.ts) → testDir: './e2e', specs smoke.spec.ts, a11y.spec.ts (via @axe-core/playwright), auth-flow.spec.ts. baseURL http://127.0.0.1:3001, chromium always + firefox in CI. Scripts e2e:smoke/e2e:a11y/e2e:auth. The Playwright public suite is what catches the nonce-CSP-on-static-routes class of regression (Frontend: Public and Marketing Pages).
Home · Architecture · ADRs · Plans · Roadmap · Contributing · Main repo · DeepWiki · Discord
Yosemite Crew is a product of DuneXploration UG (haftungsbeschränkt). This wiki mirrors the repository; where a page and the repo disagree, the repo wins. See the Wiki Style Guide.
Product & Domain
Architecture
Applications
- Backend — Overview
- Frontend / PIMS Web — Overview
- Mobile — Overview
- Desktop PIMS Shell
- Developer Portal
- SuperAdmin
Design & Accessibility
Engineering Handbook
Decisions (ADRs)
Design Docs & Plans
Meta
Canonical code & docs: main repo · Auto-generated companion: DeepWiki