test: fix node.js 25 compatibility#5918
Merged
himself65 merged 5 commits intobetter-auth:canaryfrom Nov 12, 2025
Merged
Conversation
|
@himself65 is attempting to deploy a commit to the better-auth Team on Vercel. A member of the Team first needs to authorize it. |
better-auth
@better-auth/cli
@better-auth/core
@better-auth/expo
@better-auth/passkey
@better-auth/sso
@better-auth/stripe
@better-auth/telemetry
commit: |
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR removes a workaround for Node.js 25 compatibility by deleting the vitest setup file that was used to unset localStorage in Node.js 25+ environments. The fix appears to rely on Node.js 25.2.0's built-in handling of localStorage rather than manually unsetting it.
- Removed the entire
vitest.setup.tsfile containing Node.js 25 localStorage workaround - Removed the reference to the setup file from
vitest.config.ts
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/better-auth/vitest.setup.ts | Deleted file that contained Node.js 25+ localStorage workaround |
| packages/better-auth/vitest.config.ts | Removed setupFiles configuration pointing to deleted setup file |
Comments suppressed due to low confidence (1)
packages/better-auth/vitest.setup.ts:1
- The comparison logic is incorrect. The expression
+process.versions.node.split('.')[0]! >= 25compares a number to a number, but the unary plus operator converts the string to a number. However, this comparison will be true for version '3' (which is >= 25 as false) or any string that starts with a digit >= 25. Since this code is being removed, the issue is being fixed, but it's worth noting that the original logic should have beenparseInt(process.versions.node.split('.')[0]!, 10) >= 25or similar for proper version comparison.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
787cb69 to
dc24624
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related: https://github.com/nodejs/node/releases/tag/v25.2.0
Upstream: nodejs/node#60351
Summary by cubic
Fix Vitest on Node.js 25 by removing the setup that unsets globalThis.localStorage, and bumping/patching MSW to avoid localStorage usage in Node. Tests now run on Node 25’s default environment without overrides.
Written for commit dc24624. Summary will update automatically on new commits.