[PR #5708] fix(test): use async import for db #14416

Closed
opened 2026-04-13 09:27:49 -05:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/better-auth/better-auth/pull/5708

State: closed
Merged: Yes


Fixes: https://github.com/better-auth/better-auth/issues/5702


Summary by cubic

Lazy-load database clients in test utils using async imports, so DB packages are only required when the test uses them. This prevents crashes in environments without Postgres/MySQL/MongoDB and makes teardown safer.

  • Bug Fixes
    • Load Postgres, MySQL, and MongoDB clients only when selected.
    • Import sql and recreate connections during teardown to reset schemas.
    • Consolidate imports: use createAuthClient from ../client and db exports from ../db.

Written for commit 26d3f0e1a2. Summary will update automatically on new commits.

**Original Pull Request:** https://github.com/better-auth/better-auth/pull/5708 **State:** closed **Merged:** Yes --- Fixes: https://github.com/better-auth/better-auth/issues/5702 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Lazy-load database clients in test utils using async imports, so DB packages are only required when the test uses them. This prevents crashes in environments without Postgres/MySQL/MongoDB and makes teardown safer. - **Bug Fixes** - Load Postgres, MySQL, and MongoDB clients only when selected. - Import sql and recreate connections during teardown to reset schemas. - Consolidate imports: use createAuthClient from ../client and db exports from ../db. <sup>Written for commit 26d3f0e1a207bdf5dbfd726eeb7dbff190e140c6. Summary will update automatically on new commits.</sup> <!-- End of auto-generated description by cubic. -->
GiteaMirror added the pull-request label 2026-04-13 09:27:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#14416