better-auth/adapters/test doesn't seem to exist anymore #2991

Closed
opened 2026-03-13 10:32:44 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @KazimirPodolski on GitHub (Mar 5, 2026).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

  1. Follow adapter testing docs
  2. The line import { runAdapterTest } from "better-auth/adapters/test"; fails:
    TS2307: Cannot find module better-auth/adapters/test or its corresponding type declarations.
    

Current vs. Expected behavior

No error / another import.

What version of Better Auth are you using?

1.5.3

System info

Unrelated

Which area(s) are affected? (Select all that apply)

Documentation, Package

Auth config (if applicable)


Additional context

No response

Originally created by @KazimirPodolski on GitHub (Mar 5, 2026). ### Is this suited for github? - [ ] Yes, this is suited for github ### To Reproduce 1. Follow [adapter testing docs](https://better-auth.com/docs/guides/create-a-db-adapter#test-your-adapter) 2. The line `import { runAdapterTest } from "better-auth/adapters/test";` fails: ``` TS2307: Cannot find module better-auth/adapters/test or its corresponding type declarations. ``` ### Current vs. Expected behavior No error / another import. ### What version of Better Auth are you using? 1.5.3 ### System info ```bash Unrelated ``` ### Which area(s) are affected? (Select all that apply) Documentation, Package ### Auth config (if applicable) ```typescript ``` ### Additional context _No response_
GiteaMirror added the adapter label 2026-03-13 10:32:44 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Mar 5, 2026):

The runAdapterTest and runNumberIdAdapterTest functions were removed in better-auth v1.5. The adapter testing utilities have been moved to a separate package.

New approach:

  1. Install @better-auth/test-utils
  2. Import from the new location:
import { testAdapter } from "@better-auth/test-utils/adapter";

Example usage:

import { testAdapter } from "@better-auth/test-utils/adapter";

testAdapter({
  adapter: (options) => myAdapter(options),
  runMigrations: async (betterAuthOptions) => { /* migration logic */ },
  tests: [
    normalTestSuite,      // replaces runAdapterTest
    numberIdTestSuite,    // replaces runNumberIdAdapterTest
  ]
});

The documentation for creating a database adapter appears to be outdated and still references the old import path.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Mar 5, 2026): <!-- Answer --> The `runAdapterTest` and `runNumberIdAdapterTest` functions [were removed in better-auth v1.5](https://github.com/better-auth/better-auth/blob/b34e200513b23d9fb913698173cd408f01f63f9c/docs/content/blogs/1-5.mdx). The adapter testing utilities have been moved to a separate package. **New approach:** 1. Install `@better-auth/test-utils` 2. Import from the new location: ```typescript import { testAdapter } from "@better-auth/test-utils/adapter"; ``` Example usage: ```typescript import { testAdapter } from "@better-auth/test-utils/adapter"; testAdapter({ adapter: (options) => myAdapter(options), runMigrations: async (betterAuthOptions) => { /* migration logic */ }, tests: [ normalTestSuite, // replaces runAdapterTest numberIdTestSuite, // replaces runNumberIdAdapterTest ] }); ``` The [documentation for creating a database adapter](https://github.com/better-auth/better-auth/blob/b34e200513b23d9fb913698173cd408f01f63f9c/docs/content/docs/guides/create-a-db-adapter.mdx) appears to be outdated and still references the old import path. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/2725f079-aa27-49b3-bbed-c776021ff98f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/2725f079-aa27-49b3-bbed-c776021ff98f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/2725f079-aa27-49b3-bbed-c776021ff98f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/2725f079-aa27-49b3-bbed-c776021ff98f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/2725f079-aa27-49b3-bbed-c776021ff98f?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/2725f079-aa27-49b3-bbed-c776021ff98f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/2725f079-aa27-49b3-bbed-c776021ff98f?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20%60runAdapterTest%60%20and%20%60runNumberIdAdapterTest%60%20functions%20%5Bwere%20removed%20in%20better-auth%20v1.5%5D%28https%3A//github.com/better-auth/better-auth/blob/b34e200513b23d9fb913698173cd408f01f63f9c/docs/content/blogs/1-5.mdx%29.%20The%20adapter%20testing%20utilities%20have%20been%20moved%20to%20a%20separate%20package.%0A%0A%2A%2ANew%20approach%3A%2A%2A%0A%0A1.%20Install%20%60%40better-auth/test-utils%60%0A2.%20Import%20from%20the%20new%20location%3A%0A%0A%60%60%60typescript%0Aimport%20%7B%20testAdapter%20%7D%20from%20%22%40better-auth/test-utils/adapter%22%3B%0A%60%60%60%0A%0AExample%20usage%3A%0A%0A%60%60%60typescript%0Aimport%20%7B%20testAdapter%20%7D%20from%20%22%40better-auth/test-utils/adapter%22%3B%0A%0AtestAdapter%28%7B%0A%20%20adapter%3A%20%28options%29%20%3D%3E%20myAdapter%28options%29%2C%0A%20%20runMigrations%3A%20async%20%28betterAuthOptions%29%20%3D%3E%20%7B%20/%2A%20migration%20logic%20%2A/%20%7D%2C%0A%20%20tests%3A%20%5B%0A%20%20%20%20normalTestSuite%2C%20%20%20%20%20%20//%20replaces%20runAdapterTest%0A%20%20%20%20numberIdTestSuite%2C%20%20%20%20//%20replaces%20runNumberIdAdapterTest%0A%20%20%5D%0A%7D%29%3B%0A%60%60%60%0A%0AThe%20%5Bdocumentation%20for%20creating%20a%20database%20adapter%5D%28https%3A//github.com/better-auth/better-auth/blob/b34e200513b23d9fb913698173cd408f01f63f9c/docs/content/docs/guides/create-a-db-adapter.mdx%29%20appears%20to%20be%20outdated%20and%20still%20references%20the%20old%20import%20path.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/8406)
Author
Owner

@itamarzwi commented on GitHub (Mar 5, 2026):

From the 1.5 blog post:

The better-auth/adapters/test export has been removed. Use the testUtils plugin instead.

@itamarzwi commented on GitHub (Mar 5, 2026): From the [1.5 blog post](https://better-auth.com/blog/1-5#adapter-imports): The `better-auth/adapters/test` export has been removed. Use the `testUtils` plugin instead.
Author
Owner

@himself65 commented on GitHub (Mar 6, 2026):

Sorry, but this is true, see https://github.com/better-auth/better-auth/issues/8406#issuecomment-4006205865

@himself65 commented on GitHub (Mar 6, 2026): Sorry, but this is true, see https://github.com/better-auth/better-auth/issues/8406#issuecomment-4006205865
Author
Owner

@danielfinke commented on GitHub (Mar 10, 2026):

@himself65 @itamarzwi hope you don't mind my question about this. Previously, for third-party DB adapters we were able to use the same test suite as the adapters that are in the monorepo, via runAdapterTest and runNumberIdAdapterTest. It seems like, after these test changes, we have to define our own tests (see a980b169a5/docs/content/docs/guides/create-a-db-adapter.mdx (L376-L380)), but wouldn't we want to use the same as the monorepo plugins? They are in /e2e/adapter/test/adapter-factory but not provided in the @better-auth/test-utils package.

It seems there is also some confusion around the difference between the @better-auth/test-utils package (which is in /packages/test-utils) and the testUtils plugin (which is in /packages/better-auth/src/test-utils and imported via import { testUtils } from "better-auth/plugins"). It seems like the former is what we should be using for database adapters whereas the latter is for unit testing the actual usage of BA in an application. The blog post is crossing some wires here I think?

@danielfinke commented on GitHub (Mar 10, 2026): @himself65 @itamarzwi hope you don't mind my question about this. Previously, for third-party DB adapters we were able to use the same test suite as the adapters that are in the monorepo, via `runAdapterTest` and `runNumberIdAdapterTest`. It seems like, after these test changes, we have to define our own tests (see https://github.com/better-auth/better-auth/blob/a980b169a52929485184bf4398f53ed9a1dc72c4/docs/content/docs/guides/create-a-db-adapter.mdx?plain=1#L376-L380), but wouldn't we want to use the same as the monorepo plugins? They are in `/e2e/adapter/test/adapter-factory` but not provided in the [@better-auth/test-utils](https://www.npmjs.com/package/@better-auth/test-utils) package. It seems there is also some confusion around the difference between the `@better-auth/test-utils` package (which is in `/packages/test-utils`) and the `testUtils` _plugin_ (which is in `/packages/better-auth/src/test-utils` and imported via `import { testUtils } from "better-auth/plugins"`). It seems like the former is what we should be using for database adapters whereas the latter is for unit testing the actual usage of BA in an application. The blog post is crossing some wires here I think?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2991