Skip to content

test: fix node.js 25 compatibility#5918

Merged
himself65 merged 5 commits intobetter-auth:canaryfrom
himself65:himself65/2025/11/11/node25
Nov 12, 2025
Merged

test: fix node.js 25 compatibility#5918
himself65 merged 5 commits intobetter-auth:canaryfrom
himself65:himself65/2025/11/11/node25

Conversation

@himself65
Copy link
Member

@himself65 himself65 commented Nov 11, 2025

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.

Copilot AI review requested due to automatic review settings November 11, 2025 23:43
@himself65 himself65 requested a review from Bekacru as a code owner November 11, 2025 23:43
@vercel
Copy link

vercel bot commented Nov 11, 2025

@himself65 is attempting to deploy a commit to the better-auth Team on Vercel.

A member of the Team first needs to authorize it.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 11, 2025

Open in StackBlitz

better-auth

npm i https://pkg.pr.new/better-auth/better-auth@5918

@better-auth/cli

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/cli@5918

@better-auth/core

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/core@5918

@better-auth/expo

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/expo@5918

@better-auth/passkey

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/passkey@5918

@better-auth/sso

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/sso@5918

@better-auth/stripe

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/stripe@5918

@better-auth/telemetry

npm i https://pkg.pr.new/better-auth/better-auth/@better-auth/telemetry@5918

commit: dc24624

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.ts file 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]! >= 25 compares 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 been parseInt(process.versions.node.split('.')[0]!, 10) >= 25 or similar for proper version comparison.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@himself65 himself65 force-pushed the himself65/2025/11/11/node25 branch from 787cb69 to dc24624 Compare November 12, 2025 00:56
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

@himself65 himself65 added this pull request to the merge queue Nov 12, 2025
Merged via the queue into better-auth:canary with commit c83d4fd Nov 12, 2025
9 of 12 checks passed
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.

2 participants