test(core): add Vitest setup and unit tests - #1
Merged
Conversation
…fig, and response parsing - Install Vitest and @vitest/coverage-v8 for testing - Create vitest.config.ts with coverage settings - Add 15 tests for parseUnifiedDiff covering: - Basic functionality (empty input, no patch, deleted files) - Line number annotation for added lines - Multiple hunks handling - Context lines and deleted lines - Hunk header parsing - Edge cases (special chars, empty lines, metadata) - Add 26 tests for config loading covering: - Config file discovery (JSON and YAML) - CLI options merging and precedence - Provider, platform, and severity validation - Error handling for invalid configs - Add 20 tests for OpenAI response parsing covering: - Summary style comments - Inline comment parsing with various separators - File path handling with special characters - Edge cases (empty content, high line numbers) - Constructor validation - Add test fixtures for diffs, configs, and responses - Add GitHub Actions CI workflow for automated testing - Update package.json with test scripts - Update .gitignore to exclude coverage/ Part of Phase 1, Task 2 from Evolution Plan
- Add .eslintrc.json configuration file - Fix changeset-lint.yml to fetch full git history - Fix lint errors in test files (unused imports, prefer-const) - Fix TypeScript type issues in config tests
- Rename vitest.config.ts to vitest.config.mts for ESM support - Update test scripts to use new config filename - Add empty changeset for test infrastructure changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Task 2 of Phase 1 from the Evolution Plan: Vitest setup + unit tests for parseUnifiedDiff, config loading, and response parsing.
Changes
Test Coverage
Total: 61 unit tests
How to Test
Checklist
npm run buildnpm test