Skip to content

fix: make better-sqlite3 optional in tests and doctor#399

Merged
khaliqgant merged 3 commits into
mainfrom
fix/optional-better-sqlite3-main
Feb 10, 2026
Merged

fix: make better-sqlite3 optional in tests and doctor#399
khaliqgant merged 3 commits into
mainfrom
fix/optional-better-sqlite3-main

Conversation

@khaliqgant
Copy link
Copy Markdown
Member

@khaliqgant khaliqgant commented Feb 10, 2026

Summary

  • Skip DLQ SQLite tests when better-sqlite3 is unavailable
  • Doctor command passes when ANY SQLite adapter works (not requiring all)

Problem

Tests fail when better-sqlite3 is not installed:

  1. packages/storage/src/dlq-adapter.test.ts - direct import of better-sqlite3 fails
  2. src/cli/index.test.ts > CLI > doctor - doctor command exits with error code 1

Since better-sqlite3 is an optional peer dependency (with node:sqlite as an alternative), the tests and doctor command should handle its absence gracefully.

Changes

1. packages/storage/src/dlq-adapter.test.ts

  • Dynamically import better-sqlite3 and check availability
  • Skip SQLiteDLQAdapter tests when better-sqlite3 is not installed
  • InMemoryDLQAdapter tests continue to run regardless

2. src/cli/commands/doctor.ts

  • Doctor now passes if ANY SQLite adapter (better-sqlite3 OR node:sqlite) is available
  • Missing adapters are shown as warnings, not failures
  • Exit code 0 when at least one adapter works

Test plan

  • Storage tests pass locally
  • CI passes (SQLite tests skip when better-sqlite3 unavailable)
  • Doctor command exits 0 when only node:sqlite is available

🤖 Generated with Claude Code


Open with Devin

Agent Relay and others added 2 commits February 10, 2026 12:32
better-sqlite3 is an optional peer dependency, so tests that require it
should be skipped when it's not installed. This allows the test suite
to pass in CI environments that don't have better-sqlite3.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The doctor command now considers it a success if ANY SQLite adapter
(better-sqlite3 or node:sqlite) is working, rather than requiring all
of them. Missing adapters are shown as warnings instead of failures.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 5 additional findings in Devin Review.

Open in Devin Review

Comment thread src/cli/commands/doctor.ts
When better-sqlite3 is available but node:sqlite is not (older Node),
the doctor should pass (exit 0) with a warning, not fail. Updated
test expectation to match the new behavior where ANY available
driver means success.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@khaliqgant khaliqgant merged commit 9996510 into main Feb 10, 2026
31 of 32 checks passed
@khaliqgant khaliqgant deleted the fix/optional-better-sqlite3-main branch February 10, 2026 12:50
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.

1 participant