Skip to content

fix: add Node.js 24 to CI#13440

Merged
gr2m merged 13 commits intorelease-v6.0from
add-node-24-to-ci-v6
Mar 16, 2026
Merged

fix: add Node.js 24 to CI#13440
gr2m merged 13 commits intorelease-v6.0from
add-node-24-to-ci-v6

Conversation

@gr2m
Copy link
Copy Markdown
Collaborator

@gr2m gr2m commented Mar 15, 2026

Summary

  • Add Node.js 24 to the CI test matrix and root engines field
  • Upgrade vitest from v2/v3 to v4 across all packages for Node 24 compatibility
  • Fix @testing-library/jest-dom matcher setup for vitest v4 by using explicit expect.extend(matchers) in setup files instead of import '@testing-library/jest-dom/vitest'
  • Replace File object inline snapshots with objectContaining assertions in openai and elevenlabs transcription tests (vitest v4 changed File serialization)
  • Replace Array.at() with bracket access in angular package for ES2018 compatibility
  • Restore spies after logWarnings tests to prevent leaking
  • Update SvelteKit deps in sveltekit-openai example for Node 24 support

Test plan

  • pnpm type-check:full passes
  • pnpm test passes (except pre-existing @ai-sdk/codemod test failure and @ai-sdk/rsc e2e port issue, both unrelated)

gr2m and others added 10 commits March 14, 2026 21:52
Closes #13357

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…port

@sveltejs/adapter-vercel v5 only supports Node 18/20/22. Upgrade to v6
which adds Node 24 to valid_node_versions. Also upgrade @sveltejs/kit to
v2.55+ as required by adapter v6.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Upgrade vitest to v4 in @ai-sdk/vue and @ai-sdk/mcp (were still on 2.1.4)
- Fix it() timeout option syntax in e2e tests (vitest v4 takes number, not object)
- Fix MCP oauth test to access URL and Headers properties directly
- Update MCP inline snapshot for vitest v4 formatting

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The Angular test file used .at(0) and .at(1) which require ES2022 lib,
but the project targets ES2018. This was exposed by the vitest v4 upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
In vitest v4, spyOn without restore causes stacked spies between tests,
leading to duplicate call counts. Add afterEach with vi.restoreAllMocks().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move @testing-library/jest-dom matcher registration from inline imports
to setup files for react, vue, and svelte packages. This fixes
compatibility with vitest v4 which changed how global expect extensions
work.
@tigent tigent bot added ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label maintenance CI, internal documentation, automations, etc provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider provider/anthropic Issues related to the @ai-sdk/anthropic provider provider/baseten Issues related to the @ai-sdk/baseten provider provider/elevenlabs Issues related to the @ai-sdk/elevenlabs provider provider/gateway Issues related to the @ai-sdk/gateway provider provider/google-vertex Issues related to the @ai-sdk/google-vertex provider provider/openai Issues related to the @ai-sdk/openai provider labels Mar 15, 2026
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The jscodeshift/typescript sourcemap infrastructure doesn't work
correctly on Node 24. This is a pre-existing issue unrelated to the
vitest v4 upgrade.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The jscodeshift/typescript sourcemap infrastructure is incompatible
with vitest v4. This is a pre-existing issue in the codemod package.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gr2m added a commit that referenced this pull request Mar 16, 2026
## Summary

Adds Node.js 24 to the CI test matrix and fixes all build/test
incompatibilities.

Closes #13357

## Changes

### CI & config
- Adds Node.js 24 to `.github/workflows/ci.yml` test matrix
- Adds `^24.0.0` to root `package.json` engines field

### SvelteKit example build fix
- Updates `@sveltejs/adapter-vercel` from v5 to v6 and `@sveltejs/kit`
to v2.55+ in `examples/sveltekit-openai` — adapter-vercel v5 only
supported Node 18/20/22, v6 adds Node 24

### Vitest v2 → v4 upgrade
Node 24 ships with undici v7, which enforces strict `AbortSignal`
instanceof checks in `fetch()`. The jsdom environment in vitest v2/v3
replaces the global `AbortController`/`AbortSignal` with its own
polyfill, and Node 24's native fetch rejects these with `"Expected
signal to be an instance of AbortSignal"`. Vitest v4 stops overriding
these globals
([vitest-dev/vitest#8390](vitest-dev/vitest#8390)),
fixing the incompatibility.

#### Test adaptations required by vitest v4

**`vi.fn()` arrow functions can no longer be used as constructors** —
vitest v4 wraps mock functions differently, so arrow-function mocks fail
with `TypeError: is not a constructor` when called with `new`. Fixed by
changing arrow functions to `function` expressions in mock
implementations:
-
`packages/amazon-bedrock/src/bedrock-event-stream-response-handler.test.ts`
- `packages/baseten/src/baseten-provider.unit.test.ts`
- `packages/gateway/src/gateway-provider.test.ts`
-
`packages/google-vertex/src/google-vertex-auth-google-auth-library.test.ts`

**`toStrictEqual(expect.objectContaining(...))` is stricter** — vitest
v4 now requires that `undefined` properties on the actual object (e.g.
`metadata: undefined`) also appear in the expected pattern. Since these
tests intentionally do partial matching, changed to
`toEqual(expect.objectContaining(...))`:
- `packages/angular/src/lib/chat.ng.test.ts`
- `packages/svelte/src/chat.svelte.test.ts`

**`toThrowError` with an Error object checks all properties** —
previously only checked `message`, now checks every property. The
anthropic overloaded-error test compared `requestBodyValues: {}` against
the full request body. Changed to try/catch with individual property
assertions:
- `packages/anthropic/src/anthropic-messages-language-model.test.ts`

**`test.workspace` renamed to `test.projects`**:
- `packages/svelte/vite.config.ts`

### Other test fixes
- `packages/openai` and `packages/elevenlabs`: Made `File` object
snapshot tests Node version-agnostic (Node 24 serializes additional
`Symbol(state)` on File objects)
- `packages/mcp`: Fixed race condition in SSE reconnect test where
`server.calls[2]` was accessed before the fire-and-forget
`openInboundSse()` completed — added `vi.waitFor()`
- Pinned `tinyexec` to 1.0.2 via pnpm overrides (1.0.3 has broken
package exports on npm)

### Backports 

- v6: #13440
- v5: #13441

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
@gr2m gr2m merged commit d0c1abc into release-v6.0 Mar 16, 2026
18 checks passed
@gr2m gr2m deleted the add-node-24-to-ci-v6 branch March 16, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/provider related to a provider package. Must be assigned together with at least one `provider/*` label maintenance CI, internal documentation, automations, etc provider/amazon-bedrock Issues related to the @ai-sdk/amazon-bedrock provider provider/anthropic Issues related to the @ai-sdk/anthropic provider provider/baseten Issues related to the @ai-sdk/baseten provider provider/elevenlabs Issues related to the @ai-sdk/elevenlabs provider provider/gateway Issues related to the @ai-sdk/gateway provider provider/google-vertex Issues related to the @ai-sdk/google-vertex provider provider/openai Issues related to the @ai-sdk/openai provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants