feat: improve test coverage, add benchmarks, and enhance error handling#23
Merged
Conversation
- Add coverage thresholds to vitest config (90% statements/lines/functions, 85% branches) - Add lcov reporter for better Codecov integration - Add CI step to verify coverage thresholds - Add i18next as dev dependency for integration tests - Add comprehensive DBErrorX tests (37 tests) - Add i18next integration tests (11 tests) - Add tests for original property serialization in toJSON/fromJSON - Final coverage: 98%+ statements, 92%+ branches Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request adds comprehensive test coverage improvements, performance benchmarks, and a new AggregateErrorX class for batch error handling. The changes achieve 100% statement/line/function coverage and update the CI/CD pipeline to use Codecov v5.
Changes:
- Added 11 new test cases for edge cases and improved overall test coverage to 100% statements/lines/functions
- Added comprehensive performance benchmarks with
pnpm benchcommand - Implemented
AggregateErrorXclass for handling multiple errors in batch operations - Updated Codecov integration to v5 with main-branch-only uploads
- Added i18next integration tests as a devDependency to demonstrate ErrorXResolver usage
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| vitest.config.ts | Added lcov reporter, coverage thresholds, and exclusions for benchmarks and type-only files |
| src/types/serialization.types.ts | Added ErrorXAggregateOptions and ErrorXAggregateSerialized types for aggregate errors |
| src/types/index.ts | Exported new aggregate error types |
| src/index.ts | Exported AggregateErrorX class and related types |
| src/error.ts | Implemented ErrorX.aggregate() static method and AggregateErrorX class with full serialization support |
| src/tests/integration.test.ts | Added comprehensive i18next integration tests demonstrating ErrorXResolver usage |
| src/tests/error.test.ts | Added edge case tests for cleanStack: false, isErrorXOptions, and httpStatus extraction |
| src/tests/db-error.test.ts | Added comprehensive test coverage for DBErrorX presets |
| src/tests/aggregate.test.ts | Added comprehensive tests for AggregateErrorX functionality |
| src/benchmarks/error.bench.ts | Added performance benchmarks for all major ErrorX operations |
| pnpm-lock.yaml | Added i18next v25.8.0 as devDependency |
| package.json | Added i18next devDependency and bench script |
| README.md | Added performance section with benchmarks and Codecov badge |
| .gitignore | Added coverage directory and lcov file exclusions |
| .github/workflows/pr-checks.yml | Updated to Codecov v5 and restricted uploads to main branch only |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…zo/error-x into task/medium-level-tasks
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
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
AggregateErrorXfor batch error handlingChanges
Test Coverage
cleanStack: false,isErrorXOptions,httpStatusextraction)vitest.config.tsto exclude benchmarks and type-only files from coveragePerformance Benchmarks
src/__benchmarks__/error.bench.tswith comprehensive benchmarkspnpm benchError Aggregation
AggregateErrorXclass for handling multiple errorsErrorX.aggregate()static methodisAggregateErrorX()type guardCI/CD
Documentation
Test plan
pnpm typecheckpassespnpm lintpassespnpm testpasses (293 tests)pnpm test:coveragepasses with 100% coverage🤖 Generated with Claude Code