Skip to content

chore: more test extraction to vitest & handle any#1025

Open
ferhatelmas wants to merge 1 commit intomasterfrom
ferhat/more-vi
Open

chore: more test extraction to vitest & handle any#1025
ferhatelmas wants to merge 1 commit intomasterfrom
ferhat/more-vi

Conversation

@ferhatelmas
Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

chore

What is the current behavior?

Tests are run by jest.

What is the new behavior?

Extract more unit tests to run by vitest. Handle any.

Additional context

Reducing scope of #922

@ferhatelmas ferhatelmas requested a review from a team as a code owner April 15, 2026 22:01
Copilot AI review requested due to automatic review settings April 15, 2026 22:01
Copy link
Copy Markdown

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 PR continues the ongoing migration of unit tests from Jest to Vitest (keeping src/test/** as Jest-run integration tests), while tightening typing in a few test helpers to avoid any.

Changes:

  • Migrates multiple existing unit test suites to Vitest APIs (vi.*) and updates mocking patterns (including vi.hoisted, vi.doMock, and module reset flows).
  • Moves the escapeLike unit test out of Jest integration tests into a new Vitest unit test colocated with the implementation.
  • Adds new Vitest unit tests for database SSL utilities and a migration SQL transformer.

Reviewed changes

Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/test/search-filters.test.ts Removes escapeLike unit assertions from Jest integration tests (to be covered under Vitest).
src/storage/database/knex.test.ts Adds a new Vitest unit test for escapeLike.
src/storage/scanner/scanner-pagination.test.ts Converts scanner pagination regression test from Jest mocks to vi.
src/storage/protocols/vector/vector-store.test.ts Converts vector store manager tests to Vitest and replaces any-style bucket records with a typed helper.
src/storage/events/migrations/run-migrations.test.ts Converts migration job tests to Vitest, using vi.hoisted for stable mock references.
src/storage/backend/s3/adapter.test.ts Converts S3 backend tests to Vitest and replaces any-typed upload mock plumbing with explicit shapes.
src/storage/backend/file.test.ts Converts file backend tests to Vitest and updates mock/spy usage accordingly.
src/scripts/orphan-client-stream.test.ts Converts script unit tests to Vitest (vi.spyOn / restore flow).
src/internal/queue/event.test.ts Converts queue/event payload versioning tests to Vitest and adjusts module import paths.
src/internal/monitoring/otel-tracing.test.ts Converts OTel tracing bootstrap tests to Vitest and improves module unmock cleanup between tests.
src/internal/monitoring/otel-metrics.test.ts Converts OTel metrics bootstrap tests to Vitest and improves module unmock/reset cleanup between tests.
src/internal/database/ssl.test.ts Adds new Vitest unit tests for getSslSettings and isIpAddress.
src/internal/database/migrations/transformers/disable-concurrent-index-transformer.test.ts Adds new Vitest unit tests for the concurrent-index disabling transformer.
src/internal/database/migrations/progressive.test.ts Converts progressive migrations tests to Vitest with vi.hoisted mocks.
src/internal/cache/monitoring.test.ts Converts cache monitoring tests to Vitest timers/spies (vi.useFakeTimers, vi.spyOn, etc.).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 24481025295

Coverage decreased (-0.06%) to 82.415%

Details

  • Coverage decreased (-0.06%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • 11 coverage regressions across 5 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

11 previously-covered lines in 5 files lost coverage.

File Lines Losing Coverage Coverage
src/internal/monitoring/otel-metrics.ts 3 85.4%
src/storage/protocols/tus/s3-locker.ts 3 88.57%
src/internal/monitoring/otel-class-instrumentations.ts 2 9.09%
src/storage/backend/file.ts 2 74.28%
src/internal/monitoring/otel-tracing.ts 1 62.12%

Coverage Stats

Coverage Status
Relevant Lines: 32699
Covered Lines: 29423
Line Coverage: 89.98%
Relevant Branches: 7495
Covered Branches: 3703
Branch Coverage: 49.41%
Branches in Coverage %: Yes
Coverage Strength: 355.6 hits per line

💛 - Coveralls

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