# Run all testspnpm test# Run all tests + buildpnpm test && pnpm build# Full verification (tests + build + bundle analysis)pnpm test && pnpm build && pnpm bundle:analyze
โฟ A11y Tests
Accessibility tests use vitest-axe and axe-core to check WCAG 2.1 compliance.
How to run
# A11y tests for all componentspnpm test:a11y# A11y tests for a specific filepnpm test packages/ui/src/a11y.test.tsx
Location
packages/ui/src/a11y.test.tsx
Coverage
A11y tests cover 38 components:
All core UI components
Form components
Navigation components
Feedback components
๐งช Unit Tests
Unit tests use Vitest and React Testing Library.
How to run
# All unit testspnpm test# Watch modepnpm test:watch# With coveragepnpm test:coverage
Location
Unit tests live in *.test.tsx files next to components.
โก Performance Tests
Performance tests use Lighthouse CI to monitor Core Web Vitals and enforce budgets.
How to run
# Run Lighthouse CI locallypnpm --filter @fragment_ui/www start &lhci autorun# Check bundle sizepnpm bundle:analyze
Configuration
Lighthouse CI config:
lighthouserc.js
Performance budgets
First Contentful Paint (FCP): < 1.8s
Largest Contentful Paint (LCP): < 2.5s
Time to Interactive (TTI): < 3.8s
Total Blocking Time (TBT): < 200ms
Cumulative Layout Shift (CLS): < 0.1
๐จ Visual Regression Tests
Visual tests use Chromatic to compare component screenshots.
How to run
# Run Storybook and Chromaticpnpm storybooknpx chromatic --project-token=YOUR_TOKEN# In CI/CD Chromatic runs automatically (GitHub Actions)
Configuration
Chromatic config: packages/ui/.storybook/preview.ts and .github/workflows/chromatic.yml.
Features
Multiple viewports (mobile, tablet, desktop)
Multiple themes (light, dark)
Automatic visual diffing
Review changes before merge
๐ฆ Bundle Size Tests
Bundle analysis checks component sizes and limits.