[PR #5363] [CLOSED] test: remove runWithEndpointContext #5959

Closed
opened 2026-03-13 12:42:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5363
Author: @himself65
Created: 10/16/2025
Status: Closed

Base: canaryHead: himself65/2025/10/16/run-with


📝 Commits (10+)

📊 Changes

6 files changed (+155 additions, -232 deletions)

View changed files

📝 packages/better-auth/src/api/routes/session-api.test.ts (+46 -63)
📝 packages/better-auth/src/db/internal-adapter.test.ts (+72 -116)
📝 packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts (+4 -13)
📝 packages/better-auth/src/social.test.ts (+3 -11)
📝 packages/better-auth/src/test-utils/index.ts (+7 -0)
📝 packages/stripe/src/stripe.test.ts (+23 -29)

📄 Description

Summary by cubic

Removed runWithEndpointContext from tests and set up AsyncLocalStorage-based context in test utils. This simplifies tests and aligns them with the updated core context handling.

  • Refactors
    • Replaced runWithEndpointContext with direct internalAdapter/API calls across session, internal adapter, generic OAuth, social, and Stripe tests.
    • Test utils now enter the current auth context via getCurrentAuthContextAsyncLocalStorage when creating a test instance.
    • Kept existing assertions (headers, TTLs, session/account ops) working without the wrapper.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/5363 **Author:** [@himself65](https://github.com/himself65) **Created:** 10/16/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `himself65/2025/10/16/run-with` --- ### 📝 Commits (10+) - [`dd63280`](https://github.com/better-auth/better-auth/commit/dd6328064ffa0fe166f8f87e0f98186af0c8b1b0) fix: correct type `HookEndpointContext` and `InternalContext` - [`5cebc62`](https://github.com/better-auth/better-auth/commit/5cebc6245c799e82b91076ac275b330a48d39230) chore: lint fix - [`2c68700`](https://github.com/better-auth/better-auth/commit/2c687003cb024d8149c0dee22b91df041ce0b4f3) chore: lint fix - [`1db3b9e`](https://github.com/better-auth/better-auth/commit/1db3b9ed5e5d6bba46aa568affca2e3a639bc8a2) chore: lint fix - [`738b86a`](https://github.com/better-auth/better-auth/commit/738b86ac45b8e8be37fa1b6d3215136e9023da66) fix: type - [`85ea471`](https://github.com/better-auth/better-auth/commit/85ea471d16cbc1aa968a271928fe6d24781d77c2) fix: type - [`9721d11`](https://github.com/better-auth/better-auth/commit/9721d111217dd9a7148c05ed597016ba1b650bb1) fix: naming - [`3b1d0b7`](https://github.com/better-auth/better-auth/commit/3b1d0b7c7d5a70232136dd687964b1ae70c6d854) fix: naming - [`fde8d65`](https://github.com/better-auth/better-auth/commit/fde8d653b9a0c441b3579f6b4284f852b89b3b38) feat: export internal - [`d704ccc`](https://github.com/better-auth/better-auth/commit/d704ccc0fc28b1277c4d178c4e43217fd2827814) chore: type fix ### 📊 Changes **6 files changed** (+155 additions, -232 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/api/routes/session-api.test.ts` (+46 -63) 📝 `packages/better-auth/src/db/internal-adapter.test.ts` (+72 -116) 📝 `packages/better-auth/src/plugins/generic-oauth/generic-oauth.test.ts` (+4 -13) 📝 `packages/better-auth/src/social.test.ts` (+3 -11) 📝 `packages/better-auth/src/test-utils/index.ts` (+7 -0) 📝 `packages/stripe/src/stripe.test.ts` (+23 -29) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Removed runWithEndpointContext from tests and set up AsyncLocalStorage-based context in test utils. This simplifies tests and aligns them with the updated core context handling. - **Refactors** - Replaced runWithEndpointContext with direct internalAdapter/API calls across session, internal adapter, generic OAuth, social, and Stripe tests. - Test utils now enter the current auth context via getCurrentAuthContextAsyncLocalStorage when creating a test instance. - Kept existing assertions (headers, TTLs, session/account ops) working without the wrapper. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 12:42:50 -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#5959