chore(deps): bump vitest 4, vite 8, vite-plugin-svelte 7, typescript 6 (with adaptations)#849
Open
AntonioVentilii wants to merge 5 commits into
Open
chore(deps): bump vitest 4, vite 8, vite-plugin-svelte 7, typescript 6 (with adaptations)#849AntonioVentilii wants to merge 5 commits into
AntonioVentilii wants to merge 5 commits into
Conversation
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.
|
✅ No security or compliance issues detected. Reviewed everything up to f8619b0. Security Overview
Detected Code ChangesThe diff is too large to display a summary of code changes. |
There was a problem hiding this comment.
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
IntersectionObservershape (scrollMargin). - Adjusted Vitest setup to polyfill
TextEncoderwith an explicit cast required by TS 6’sUint8Arraygenerics 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.
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.
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.
What
Bundles the four breaking major-version dependency bumps together with the code adaptations they require, so they can land green as one unit:
vitestvite@sveltejs/vite-plugin-sveltetypescriptsvelte2tsxsvelte-checkesbuilddrops out of the lockfile — Vite 8 replaces esbuild/Rollup with Oxc/Rolldown, so it's no longer a transitive dependency.Code adaptations
infinitescroll.mock.ts—IntersectionObserverPassiveis now a class. Vitest 4 forbids invoking avi.fn()configured viamockReturnValuewithnew. Also addedscrollMarginto the observer mocks (now required by the TS 6lib.d.tsIntersectionObserverinterface).ScrollSentinel.spec.ts— the mock observer is stubbed viavi.stubGlobal; Vitest 4 cannot construct an arrow-function mock implementation withnew. AddedscrollMarginto the mock.vitest.setup.ts— cast Node'sTextEncoderto the DOM type; TS 6 madeUint8Arraygeneric, breaking the previous direct assignment.i18n.types.mjs— read the JSON file asutf-8; TS 6 typesreadFileSyncwithout an encoding as aBuffer, not astring.overrides@dfinity/eslint-config-oisy-wallet→typescript: $typescript— the config still declares atypescript@^5peer; it works fine with TS 6, so this satisfies the peer without--legacy-peer-deps(which would break auto-install of thesveltepeer).@typescript-eslint/eslint-pluginpinned to8.58.1(main's version) so the refreshed lockfile doesn't change lint behavior.Verification
All gates that pass on
mainstill pass locally:tsc -p tsconfig.spec.json— 0 errorsnpm run check(svelte-check + TS6) — 0 errorsnpm run build(Vite 8) andnpm run package(svelte-package)lintshows the same 19 pre-existing errors asmain(vitest/no-conditional-expect,svelte/no-navigation-without-resolve) — this PR adds zero new lint errors.lintande2eare already red onmain, 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.