Skip to content

feat: improve test coverage, add benchmarks, and enhance error handling#23

Merged
bombillazo merged 13 commits into
mainfrom
task/medium-level-tasks
Jan 25, 2026
Merged

feat: improve test coverage, add benchmarks, and enhance error handling#23
bombillazo merged 13 commits into
mainfrom
task/medium-level-tasks

Conversation

@bombillazo
Copy link
Copy Markdown
Owner

Summary

  • Add comprehensive test coverage improvements achieving 100% statement/line/function coverage
  • Add performance benchmarks for ErrorX operations
  • Add AggregateErrorX for batch error handling
  • Update Codecov integration to v5 with main-branch-only uploads
  • Add coverage badge to README

Changes

Test Coverage

  • Added 11 new tests for edge cases (cleanStack: false, isErrorXOptions, httpStatus extraction)
  • Updated vitest.config.ts to exclude benchmarks and type-only files from coverage
  • Coverage now at 100% statements, 100% lines, 100% functions, 95%+ branches

Performance Benchmarks

  • Added src/__benchmarks__/error.bench.ts with comprehensive benchmarks
  • Covers error creation, serialization, deserialization, chaining, and aggregation
  • Run with pnpm bench

Error Aggregation

  • Added AggregateErrorX class for handling multiple errors
  • Added ErrorX.aggregate() static method
  • Added isAggregateErrorX() type guard

CI/CD

  • Updated Codecov action to v5
  • Coverage uploads only on main branch (not PRs)

Documentation

  • Added Codecov coverage badge to README
  • Added performance benchmarks section to README

Test plan

  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (293 tests)
  • pnpm test:coverage passes with 100% coverage
  • Verify Codecov badge displays after merge

🤖 Generated with Claude Code

bombillazo and others added 5 commits January 25, 2026 13:34
- 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>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 bench command
  • Implemented AggregateErrorX class 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.

Comment thread src/error.ts Outdated
Comment thread .github/workflows/pr-checks.yml Outdated
@bombillazo bombillazo merged commit 819f3c8 into main Jan 25, 2026
3 checks passed
@bombillazo bombillazo deleted the task/medium-level-tasks branch January 25, 2026 18:29
@codecov-commenter
Copy link
Copy Markdown

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 ☂️

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.

3 participants