Skip to content

Add test coverage analysis with improvement proposals#43

Merged
andimrob merged 5 commits intomainfrom
claude/analyze-test-coverage-miang
Feb 14, 2026
Merged

Add test coverage analysis with improvement proposals#43
andimrob merged 5 commits intomainfrom
claude/analyze-test-coverage-miang

Conversation

@andimrob
Copy link
Owner

@andimrob andimrob commented Feb 13, 2026

Document the current state of testing (1 Storybook story, no unit/integration/e2e tests,
CI not running tests) and propose a phased plan covering pure function tests, hook tests,
component stories, and E2E smoke tests.

https://claude.ai/code/session_01R1f3Cb55HfJHSwXi6hck6U


Summary by cubic

Adds a full testing setup and coverage plan: 77 Vitest unit tests, Storybook stories, and CI runs unit tests with coverage to prevent regressions. Also pins pnpm and scopes test scripts to the unit project so CI doesn’t require Playwright.

  • New Features

    • Run unit tests in CI by adding pnpm test to the GitHub Actions workflow and scoping to the "unit" Vitest project.
    • Add test scripts: test, test:watch, test:coverage (unit) and test:storybook.
    • Configure a Vitest jsdom project with jest-dom setup and coverage reporting.
    • Add unit tests for xray utilities and custom hooks (typewriter, theme, active section, prism flip, reveal-on-scroll, magnetic tilt, xray toggle).
    • Add Storybook stories for Hero, About, Experience, Projects, Footer, and SectionHeading (Default + DarkMode).
    • Include TEST_COVERAGE_ANALYSIS.md with the current state and an improvement plan.
    • Pin pnpm via the packageManager field for reliable CI installs.
  • Dependencies

    • Add @testing-library/react, @testing-library/jest-dom, @testing-library/user-event, and jsdom.
    • Add Storybook addons (a11y, vitest, docs, onboarding) and eslint-plugin-storybook.
    • Configure @vitest/coverage-v8 for coverage output.

Written for commit 02998b4. Summary will update on new commits.

Document the current state of testing (1 Storybook story, no unit/integration/e2e tests,
CI not running tests) and propose a phased plan covering pure function tests, hook tests,
component stories, and E2E smoke tests.

https://claude.ai/code/session_01R1f3Cb55HfJHSwXi6hck6U
Phase 1 — Foundation:
- Add `test`, `test:watch`, and `test:coverage` scripts to package.json
- Add Vitest unit test project (jsdom) alongside existing Storybook project
- Add `pnpm run test` step to CI workflow
- Install @testing-library/react, @testing-library/jest-dom, jsdom

Phase 2 — Pure function tests (26 tests):
- src/xray/highlight.test.ts: esc(), highlight(), color constants, JS_RULES

Phase 3 — Hook tests (44 tests):
- src/hooks/useTypewriter.test.ts: typing animation, cursor lifecycle, cleanup
- src/hooks/useTheme.test.ts: localStorage, system preference, toggle
- src/hooks/useActiveSection.test.ts: scroll-based section detection
- src/hooks/usePrismFlip.test.tsx: flip count, quip cycling, confetti/coin triggers
- src/hooks/useRevealOnScroll.test.tsx: IntersectionObserver integration
- src/hooks/useMagneticTilt.test.ts: tilt math, attract range, disabled state
- src/xray/useXRay.test.ts: keyboard toggle, modifier/input filtering

Phase 4 — Component Storybook stories:
- Hero, About, Experience, Projects, Footer, SectionHeading (Default + DarkMode)

https://claude.ai/code/session_01R1f3Cb55HfJHSwXi6hck6U
- highlight.test.ts: verify escaping with empty rules, add string/keyword
  precedence test
- useXRay.test.ts: add SELECT element, sourceHTML loading, ensureFont,
  and non-x key tests
- useActiveSection.test.ts: add "last section wins" test, threshold
  boundary test
- usePrismFlip.test.tsx: add auto-rotate timer and faceBg assertions
- useMagneticTilt.test.ts: validate transform format with regex instead
  of loose string contains
- useRevealOnScroll.test.tsx: replace `as any` casts with typed MockIO
  interface
- useTypewriter.test.ts: assert cursor stays visible during typing

77 tests, all passing.

https://claude.ai/code/session_01R1f3Cb55HfJHSwXi6hck6U
@netlify
Copy link

netlify bot commented Feb 13, 2026

Deploy Preview for symphonious-blancmange-7aafce ready!

Name Link
🔨 Latest commit 02998b4
🔍 Latest deploy log https://app.netlify.com/projects/symphonious-blancmange-7aafce/deploys/698fa53ffee90c0007d2c185
😎 Deploy Preview https://deploy-preview-43--symphonious-blancmange-7aafce.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 21 files

pnpm/action-setup@v4 requires an explicit pnpm version. Add
`packageManager` to package.json so the action picks it up
automatically.

https://claude.ai/code/session_01R1f3Cb55HfJHSwXi6hck6U
`vitest run` without --project runs all projects including the
storybook browser project, which requires Playwright's Chromium to
be installed. CI doesn't have that. Scope test/test:watch/test:coverage
to --project unit and add a separate test:storybook script.

https://claude.ai/code/session_01R1f3Cb55HfJHSwXi6hck6U
@andimrob andimrob merged commit 28baec0 into main Feb 14, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants