Skip to content

Add testing infrastructure with Vitest and Testing Library#4

Merged
matiasperz merged 1 commit into
mainfrom
claude/tender-goodall-HRIeC
Jun 3, 2026
Merged

Add testing infrastructure with Vitest and Testing Library#4
matiasperz merged 1 commit into
mainfrom
claude/tender-goodall-HRIeC

Conversation

@matiasperz

Copy link
Copy Markdown
Contributor

Summary

This PR adds comprehensive testing infrastructure to the library template, including Vitest configuration, Testing Library setup, example tests, and CI integration.

Key Changes

  • Vitest Configuration (vitest.config.ts): Set up Vitest with jsdom environment for testing React components, global test APIs, and automatic test file discovery
  • Test Setup (vitest.setup.ts): Configure jest-dom matchers for enhanced DOM assertions
  • Example Tests: Added test files demonstrating testing patterns:
    • packages/core/core.test.tsx: React component and hook testing with Testing Library
    • packages/core/index.test.ts: Module export validation
  • CI Workflow (.github/workflows/ci.yml): New GitHub Actions workflow that runs typecheck and tests on every PR and push to main
  • Package Scripts: Added test and test:watch commands to package.json
  • Dependencies: Added Vitest, Testing Library (React, DOM, jest-dom), jsdom, and react-dom as dev dependencies
  • Documentation (README.md): Added testing section explaining the setup and how to run tests
  • TypeScript Config: Updated tsconfig.json to include Vitest config files

Notable Details

  • Tests run in a jsdom environment, enabling both logic and React component testing
  • Test files follow the convention of living alongside source code as *.test.ts / *.test.tsx
  • CI automatically validates code quality (typecheck) and test suite on every PR
  • Setup is zero-config for developers—just run pnpm test or pnpm test:watch

https://claude.ai/code/session_01JZ7gpANXhJs9fkhrrLMz94

- Configure Vitest with jsdom + Testing Library for component/logic tests
- Add example tests for core component, hook, and VERSION export
- Add test / test:watch scripts
- Run typecheck + tests on every PR via .github/workflows/ci.yml
- Document testing in README

https://claude.ai/code/session_01JZ7gpANXhJs9fkhrrLMz94
@matiasperz matiasperz merged commit e8f5e36 into main Jun 3, 2026
1 check 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