Skip to content

chore(upgrade): Node 24, vitest 4 - #7200

Merged
Nick-Lucas merged 13 commits into
mainfrom
chore/node24
Mar 2, 2026
Merged

Nick-Lucas merged 13 commits into
mainfrom
chore/node24

Conversation

@Nick-Lucas

@Nick-Lucas Nick-Lucas commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Closes #

🎯 Changes

What changes are made in this PR? Is it a feature or a bug fix?

βœ… Checklist

  • I have followed the steps listed in the Contributing guide.
  • If necessary, I have added documentation related to the changes made.
  • I have added or updated the tests related to the changes made.

Summary by CodeRabbit

  • Chores
    • Updated Node.js requirement to 24.x across configs and toolchain; upgraded Vitest-related packages and several dev devDependencies (including jsdom and jest-dom).
  • Bug Fixes
    • Fixed cookie header handling to prevent duplication when sending responses.
    • Standardized abort-related error messages reported in streaming scenarios.
  • Tests
    • Adjusted tests and snapshots, added a Node test environment directive, enabled project-based Vitest runs and mock restoration, and tweaked a FormData-related test.

Copilot AI review requested due to automatic review settings March 2, 2026 13:11
@Nick-Lucas
Nick-Lucas requested a review from a team as a code owner March 2, 2026 13:11
@vercel

vercel Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-prisma-starter Ready Ready Preview Mar 2, 2026 3:16pm
og-image Ready Ready Preview, Comment Mar 2, 2026 3:16pm

Request Review

@coderabbitai

coderabbitai Bot commented Mar 2, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▢️ Resume reviews
  • πŸ” Trigger review

Walkthrough

Bumps Node/toolchain to Node 24, updates test dependencies and Vitest config, adjusts tests/snapshots for AbortError wording, changes FormData construction in a client test, and ensures Set-Cookie headers are applied from the response cookie source when writing Node HTTP responses.

Changes

Cohort / File(s) Summary
Node/toolchain pins
\.github/setup/action.yml, .nvmrc, .tool-versions, package.json
Upgrade Node pins and engines to Node 24.x across CI and repo config.
Testing deps & examples
package.json, packages/tests/package.json, packages/react-query/package.json, packages/*/package.json, examples/next-prisma-starter/package.json
Bump Vitest, @testing-library/jest-dom, and jsdom versions in root, packages, and examples.
Vitest config
vitest.config.ts
Add projects, set execArgv: ['--expose-gc'], enable restoreMocks, and adjust test setup ordering (remove poolOptions).
Test environment
packages/tests/server/adapters/fastify.test.ts
Add // @vitest-environment node directive to the test file.
Test snapshot updates (abort errors)
packages/server/src/unstable-core-do-not-import/stream/jsonl.test.ts, packages/tests/server/regression/issue-6461-stream-error.test.ts, packages/tests/server/streaming.test.ts
Update inline snapshots to expect AbortError: This operation was aborted instead of prior DOMException snapshots.
Set-Cookie handling
packages/server/src/adapters/node-http/writeResponse.ts
Skip Set-Cookie during header iteration and apply cookies afterwards via response.headers.getSetCookie() to avoid duplication/overwrite.
FormData test change
packages/next/src/app-dir/client.test.tsx
Replace new FormData(e.currentTarget) with new FormData() and manually set the text field from the form element before mutation.
Minor formatting
www/scripts/check-twoslash.ts
Refactor a filter expression across multiple lines; no behavior change.

Sequence Diagram(s)

(omitted)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

♻️ autoupdate

Suggested reviewers

  • KATT

Poem

🐰 I hopped from twenty-two up to twenty-four,
Tests refreshed and snapshots more,
Cookies placed in just one space,
FormData trimmed with gentle pace,
A little rabbit cheers the score.

πŸš₯ Pre-merge checks | βœ… 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only unfilled template placeholders with no concrete information about the changes, rationale, or implementation details. Fill in the 'Changes' section with a clear description of what was upgraded and why, and update the checklist items based on actual work completed.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
βœ… Passed checks (1 passed)
Check name Status Explanation
Title check βœ… Passed The title accurately summarizes the main changes: upgrading Node.js to version 24 and vitest to version 4 across the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/node24

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❀️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@railway-app
railway-app Bot temporarily deployed to trpc-sse-and-websockets / trpc-pr-7200 March 2, 2026 13:11 Destroyed
@railway-app

railway-app Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

πŸš… Deployed to the trpc-pr-7200 environment in trpc-sse-and-websockets

Service Status Web Updated (UTC)
next-prisma-websockets-starter 😴 Sleeping (View Logs) Mar 2, 2026 at 3:39 pm
next-sse-chat 😴 Sleeping (View Logs) Web Mar 2, 2026 at 3:27 pm

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

πŸ€– Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@package.json`:
- Line 6: The package.json engines field requires Node "^24.0.0" but the
monorepo still uses "@types/node" ^22.13.5; update the type definitions to match
the runtime by bumping "@types/node" to a 24.x version (e.g., ^24.x.x) in the
root package.json and in every workspace package.json where "@types/node" is
declared (or update devDependencies/tools that pin it), ensuring
package-lock/yarn.lock is refreshed and CI types build passes; if you
intentionally must keep Node 22 typings, add a clear comment in the root README
or package.json explaining the compatibility decision instead of changing
versions.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between e870051 and db3e5de.

β›” Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
πŸ“’ Files selected for processing (13)
  • .github/setup/action.yml
  • .nvmrc
  • .tool-versions
  • package.json
  • packages/next/src/app-dir/client.test.tsx
  • packages/server/src/adapters/node-http/writeResponse.ts
  • packages/server/src/unstable-core-do-not-import/stream/jsonl.test.ts
  • packages/tests/package.json
  • packages/tests/server/adapters/fastify.test.ts
  • packages/tests/server/regression/issue-6461-stream-error.test.ts
  • packages/tests/server/streaming.test.ts
  • vitest.config.ts
  • vitest.projects.json

Comment thread package.json
"type": "module",
"engines": {
"node": "^22.18.0",
"node": "^24.0.0",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Root engine + `@types/node`:"
jq -r '.engines.node as $e | "engines.node=\($e)"' package.json
jq -r '.dependencies["@types/node"] // .devDependencies["@types/node"] // "MISSING"' package.json \
  | sed 's/^/@types\/node=/'

echo
echo "Workspace package.json files with `@types/node` pins:"
fd package.json -t f | while read -r file; do
  v=$(jq -r '.dependencies["@types/node"] // .devDependencies["@types/node"] // empty' "$file")
  if [ -n "$v" ]; then
    echo "$file -> $v"
  fi
done

Repository: trpc/trpc

Length of output: 1710


Update @types/node to align with Node 24 runtime requirement.

Line 6 specifies engines.node: ^24.0.0, but @types/node remains at ^22.13.5 across the entire monorepo (root and all 33+ workspace packages). This mismatch between runtime and type definitions can cause compile-time API surface misalignment and potential type errors. Bump @types/node to ^24.x.x to match the Node 24 runtime requirement, or document if Node 22 typings are intentionally maintained for compatibility reasons.

πŸ€– Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@package.json` at line 6, The package.json engines field requires Node
"^24.0.0" but the monorepo still uses "@types/node" ^22.13.5; update the type
definitions to match the runtime by bumping "@types/node" to a 24.x version
(e.g., ^24.x.x) in the root package.json and in every workspace package.json
where "@types/node" is declared (or update devDependencies/tools that pin it),
ensuring package-lock/yarn.lock is refreshed and CI types build passes; if you
intentionally must keep Node 22 typings, add a clear comment in the root README
or package.json explaining the compatibility decision instead of changing
versions.

@autofix-ci
autofix-ci Bot requested a review from a team as a code owner March 2, 2026 13:18
@railway-app
railway-app Bot temporarily deployed to trpc-sse-and-websockets / trpc-pr-7200 March 2, 2026 13:18 Destroyed
const cookies = response.headers.getSetCookie();
if (cookies.length > 0) {
rawResponse.setHeader('set-cookie', cookies);
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this approach is correct/modern and has support for node 19.7+, and v20 which is the oldest LTS so that's fine.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the repo’s runtime/tooling baseline for a Node 24-centric development and CI environment, along with accompanying test/config adjustments needed for the newer Node/Vitest/jsdom behavior.

Changes:

  • Bump Node/Vitest-related tooling (Node 24 engines + CI setup, Vitest v4, jest-dom/jsdom updates) and add a Vitest projects definition.
  • Update multiple test snapshots to match AbortError/DOMException message changes under newer Node/jsdom.
  • Fix Node HTTP adapter response header forwarding to correctly handle Set-Cookie via getSetCookie().

Reviewed changes

Copilot reviewed 14 out of 16 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
vitest.projects.json Introduces a Vitest projects/workspace definition targeting packages/*.
vitest.config.ts Updates Vitest setup files (adds jest-dom) and adjusts test runner options for the new baseline.
packages/tests/server/streaming.test.ts Updates inline snapshots for abort behavior/message changes.
packages/tests/server/regression/issue-6461-stream-error.test.ts Updates abort error snapshot to match new error formatting.
packages/tests/server/adapters/fastify.test.ts Forces Node test environment for this suite.
packages/tests/package.json Bumps jsdom dependency version.
packages/server/src/unstable-core-do-not-import/stream/jsonl.test.ts Updates abort-related snapshots/messages.
packages/server/src/adapters/node-http/writeResponse.ts Ensures Set-Cookie is forwarded correctly by using headers.getSetCookie().
packages/next/src/app-dir/client.test.tsx Avoids FormData(formElement) usage by constructing FormData manually in the test.
package.json Moves engines to Node 24 and bumps Vitest + related dependencies.
.tool-versions Pins Node version for asdf users to Node 24.
.nvmrc Updates nvm Node version target to 24.
.github/setup/action.yml Updates GitHub Actions setup-node to 24.x.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

πŸ’‘ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .tool-versions Outdated
@@ -1,2 +1,2 @@
nodejs 20.10.0
nodejs 24.13.1
pnpm 8.15.5

Copilot AI Mar 2, 2026

Copy link

Choose a reason for hiding this comment

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

.tool-versions still pins pnpm 8.15.5, but the repo’s root package.json declares packageManager: [email protected] / engines.pnpm: ^9.12.2. This mismatch can cause local toolchain drift for asdf users (different lockfile behavior, install layout, etc.). Consider updating the pinned pnpm version here to match the repo’s declared pnpm version.

Suggested change
pnpm 8.15.5
pnpm 9.12.2

Copilot uses AI. Check for mistakes.
@pkg-pr-new

pkg-pr-new Bot commented Mar 2, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@trpc/client

npm i https://pkg.pr.new/@trpc/client@7200

@trpc/next

npm i https://pkg.pr.new/@trpc/next@7200

@trpc/react-query

npm i https://pkg.pr.new/@trpc/react-query@7200

@trpc/server

npm i https://pkg.pr.new/@trpc/server@7200

@trpc/tanstack-react-query

npm i https://pkg.pr.new/@trpc/tanstack-react-query@7200

@trpc/upgrade

npm i https://pkg.pr.new/@trpc/upgrade@7200

commit: 6926aad

@Nick-Lucas
Nick-Lucas merged commit 6c2e9b3 into main Mar 2, 2026
41 checks passed
@Nick-Lucas
Nick-Lucas deleted the chore/node24 branch March 2, 2026 16:50
@github-actions

github-actions Bot commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Mar 3, 2026

This branch was successfully deployed

5 active deployments
Preview – www β€” 4aab21a2 Deployed Mar 2, 2026 by vercel[bot]
Preview – examples-todomvc β€” 4aab21a2 Deployed Mar 2, 2026 by vercel[bot]
Preview – next-prisma-starter β€” 4aab21a2 Deployed Mar 2, 2026 by vercel[bot]
Preview – og-image β€” 4aab21a2 Deployed Mar 2, 2026 by vercel[bot]
Preview – trpc-next-app-dir β€” 4aab21a2 Deployed Mar 2, 2026 by vercel[bot]
trpc-sse-and-websockets / trpc-pr-7200 β€” 4aab21a2 Deployed Mar 2, 2026 by railway-app[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants