Skip to content

chore(deps): bump vitest 4, vite 8, vite-plugin-svelte 7, typescript 6 (with adaptations)#849

Open
AntonioVentilii wants to merge 5 commits into
mainfrom
chore/major-dep-bumps
Open

chore(deps): bump vitest 4, vite 8, vite-plugin-svelte 7, typescript 6 (with adaptations)#849
AntonioVentilii wants to merge 5 commits into
mainfrom
chore/major-dep-bumps

Conversation

@AntonioVentilii

Copy link
Copy Markdown
Collaborator

What

Bundles the four breaking major-version dependency bumps together with the code adaptations they require, so they can land green as one unit:

Package From To
vitest 3.2.4 4.1.9
vite 7.x 8.0.16
@sveltejs/vite-plugin-svelte 6.x 7.1.2
typescript 5.3.3 6.0.3
svelte2tsx 0.7.x 0.7.56 (TS6 support)
svelte-check 4.2.x 4.6.0 (TS6 support)

esbuild drops out of the lockfile — Vite 8 replaces esbuild/Rollup with Oxc/Rolldown, so it's no longer a transitive dependency.

Code adaptations

  • infinitescroll.mock.tsIntersectionObserverPassive is now a class. Vitest 4 forbids invoking a vi.fn() configured via mockReturnValue with new. Also added scrollMargin to the observer mocks (now required by the TS 6 lib.d.ts IntersectionObserver interface).
  • ScrollSentinel.spec.ts — the mock observer is stubbed via vi.stubGlobal; Vitest 4 cannot construct an arrow-function mock implementation with new. Added scrollMargin to the mock.
  • vitest.setup.ts — cast Node's TextEncoder to the DOM type; TS 6 made Uint8Array generic, breaking the previous direct assignment.
  • i18n.types.mjs — read the JSON file as utf-8; TS 6 types readFileSync without an encoding as a Buffer, not a string.

overrides

  • @dfinity/eslint-config-oisy-wallettypescript: $typescript — the config still declares a typescript@^5 peer; it works fine with TS 6, so this satisfies the peer without --legacy-peer-deps (which would break auto-install of the svelte peer).
  • @typescript-eslint/eslint-plugin pinned to 8.58.1 (main's version) so the refreshed lockfile doesn't change lint behavior.

Verification

All gates that pass on main still pass locally:

  • tsc -p tsconfig.spec.json — 0 errors
  • ✅ tests — 331 passed (60 files)
  • npm run check (svelte-check + TS6) — 0 errors
  • npm run build (Vite 8) and npm run package (svelte-package)
  • ✅ formatting — clean
  • ⚠️ lint shows the same 19 pre-existing errors as main (vitest/no-conditional-expect, svelte/no-navigation-without-resolve) — this PR adds zero new lint errors. lint and e2e are already red on main, independent of this change.

Note

This does not close the existing Dependabot PRs (#845, #843, #824) — they're left untouched. This PR is an alternative that bundles the bumps with the necessary adaptations.

Major-version bumps that require code adaptations:

- vitest 3.2.4 -> 4.1.9
- vite 7 -> 8 (esbuild/rollup replaced by oxc/rolldown internally)
- @sveltejs/vite-plugin-svelte 6 -> 7
- typescript 5.3.3 -> 6.0.3 (+ svelte2tsx, svelte-check for TS6 support)

Adaptations:
- infinitescroll.mock.ts: IntersectionObserverPassive is now a class
  (vitest 4 forbids `new` on a `vi.fn()` configured via mockReturnValue);
  added `scrollMargin` to the observer mocks (required by TS6 lib.d.ts).
- ScrollSentinel.spec.ts: stub the observer class via vi.stubGlobal
  (vitest 4 cannot construct an arrow-function mock implementation).
- vitest.setup.ts: cast Node's TextEncoder (TS6 made Uint8Array generic).
- i18n.types.mjs: read the JSON file as utf-8 (TS6 NonSharedBuffer).

overrides:
- @dfinity/eslint-config-oisy-wallet -> typescript: keeps its `typescript@^5`
  peer satisfied by TS6 (the config works fine with TS6).
- @typescript-eslint/eslint-plugin pinned to 8.58.1 to keep lint behavior
  aligned with main while the lockfile is refreshed.
@AntonioVentilii AntonioVentilii requested review from a team as code owners June 15, 2026 14:20
@zeropath-ai

zeropath-ai Bot commented Jun 15, 2026

Copy link
Copy Markdown

No security or compliance issues detected. Reviewed everything up to f8619b0.

Security Overview
Detected Code Changes

The diff is too large to display a summary of code changes.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Bundles major dependency upgrades (Vitest 4, Vite 8, vite-plugin-svelte 7, TypeScript 6) together with the minimal code adaptations needed to keep the test/build toolchain working under the new versions.

Changes:

  • Updated IntersectionObserver mocks to be constructible under Vitest 4 and to satisfy TS 6’s IntersectionObserver shape (scrollMargin).
  • Adjusted Vitest setup to polyfill TextEncoder with an explicit cast required by TS 6’s Uint8Array generics change.
  • Updated an i18n type-generation script to read JSON as UTF-8, and bumped related dependencies + added npm overrides.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vitest.setup.ts Adjusts global TextEncoder assignment for TS 6 compatibility.
src/tests/lib/mocks/infinitescroll.mock.ts Reworks observer mocks to be class-based/constructible and TS 6 compliant.
src/tests/lib/components/ScrollSentinel.spec.ts Stubs IntersectionObserver via vi.stubGlobal for Vitest 4 constructibility.
scripts/i18n.types.mjs Reads JSON with explicit encoding to satisfy TS 6 typing expectations.
package.json Bumps toolchain deps and adds overrides to manage peer/version constraints.

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

Comment thread package.json Outdated
AntonioVentilii and others added 4 commits June 15, 2026 16:48
The lockfile generated on macOS was missing the Linux-resolved
@emnapi/core / @emnapi/runtime nodes (transitive optional deps of
@napi-rs/wasm-runtime, pulled in by Rolldown), so CI's `npm ci` on
Linux failed with "Missing ... from lock file". Regenerated the
lockfile in a Linux container so all platforms' optional deps are
recorded.

Also pin to keep CI behavior aligned with main while the lockfile is
refreshed (both float otherwise on a fresh resolve):
- @dfinity/eslint-config-oisy-wallet 0.2.2 (0.2.4 pulls eslint 10,
  which conflicts with the typescript-eslint parser peer — out of scope)
- prettier 3.6.2 (3.8.x reformats unrelated files)
Pinning only @typescript-eslint/eslint-plugin left a mixed set (parser
and others floated to 8.61.0). The typescript-eslint packages are a
tightly-versioned family, so pin them all to 8.58.1 for a consistent
toolchain matching main.
Replaces the pinned 0.2.2 + the whole typescript-eslint override set with
the new v0.5.0 config, which manages a consistent typescript-eslint set
through its peers (no manual pins needed). v0.5.0 requires prettier ^3.8.1
and brings eslint-plugin-import-x + eslint 10 support.

Lint adaptations (lint now passes — it was already red on main):
- ChipGroup/Dropdown/Input/ProgressBar specs: remove conditional `expect`
  (vitest/no-conditional-expect) via unconditional assertions, optional
  chaining, or a throw-guard to narrow nullable elements (no `!`, which the
  config forbids).
- import/order (import-x): drop blank lines splitting import groups; the
  root-relative import in vitest.setup.ts gets a scoped disable (import-x
  mis-handles it under the config's empty `groups`).
- resources/+page.svelte: wrap the internal link in `resolve()`
  (svelte/no-navigation-without-resolve).
- html.utils.ts: drop a now-unnecessary type assertion.
- eslint.config.mjs: disable `no-useless-assignment` for *.svelte — eslint
  10 misreads Svelte `$:` reactive reassignments as useless.
- prettier 3.8 reformat of QRCodeReader.svelte.

Lockfile regenerated on Linux so the cross-platform optional deps
(@emnapi/*) required by `npm ci` on CI are present.
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