chore(deps): update vitest to 5.0.1 - #907
CataldoMazzilli wants to merge 4 commits into
Conversation
Bumps vitest and @vitest/coverage-istanbul together — the coverage provider pins vitest as an exact peer — which also realigns the pair after the 4.1.11 security bump moved only vitest. Node 22.23.1 in CI and Vite 7.3.2 already satisfy vitest 5's raised floors, and the config needed no change: `clearMocks` was already explicit (it is now the default), and `outputFile` keeps the junit report at ./junit.xml rather than the new .vitest/ default, so the pipeline still finds it. Two things did need attention: Vitest 5 inlined the `expect` package, changing `Assertion` from one type parameter to two and dropping support for matcher augmentations declared against the global `jest` namespace. Both @testing-library/jest-dom (7.0.1) and @emotion/jest (11.14.2) still register theirs that way, so all 487 jest-dom and emotion assertions stopped type-checking. src/vitest-matchers.d.ts re-declares those matchers on vitest's own `Matchers` interface until the two libraries ship support; it is scoped to the test types and does not reach the published API report. Coverage globs are no longer matched too eagerly, so `**/types/*` stops excluding nested paths. src/types/network/soap.ts now enters the report — it exports the runtime type guard isRawErrorSoapResponse, re-exported from src/lib.ts, which was silently unmeasured before. It comes in fully covered. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
# Conflicts: # pnpm-lock.yaml
|
Sorry for the dismissed approval — #906 (jsdom 30) merged in the meantime and made the lockfile conflict, so this branch now carries a merge of Re-verified on the merged state, with vitest 5 and jsdom 30 now both in play: I have also expanded the description with the upstream status of the two matcher libraries, since it bears on whether the type bridge is worth taking: jest-dom has #738, opened four days ago with no maintainer reply yet, while @emotion/jest has #3132, an untriaged feature request open since 2023 on a repository with no commits on main since November 2025. So the jest-dom half of the bridge is likely short-lived and the |
Conflicts were limited to package.json and pnpm-lock.yaml. Resolved by taking main for every dependency, keeping only vitest and @vitest/coverage-istanbul at 5.0.0 from this branch, and regenerating the lockfile from main's. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Patch release of 2026-09-15, tracked together with @vitest/coverage-istanbul, which pins vitest as an exact peer. Nothing in it touches the matcher typings: the `Matchers` declaration is identical to 5.0.0, so src/vitest-matchers.d.ts is unchanged and the type-check stays clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
|
Rebased on the current
Sorry for the dismissed approval — the push invalidated it again. |

0 New Issues
0 Fixed Issues
0 Accepted Issues
No data about coverage (76.90% Estimated after merge)
What
Updates vitest to 5.0.1, together with its coverage provider —
@vitest/coverage-istanbulpins vitest as an exact peer, so the two always move together.vitest4.1.115.0.1@vitest/coverage-istanbul4.1.115.0.15.0.1 (2026-09-15) is a patch on top of the 5.0.0 this branch originally carried. Nothing in it touches the matcher typings: the
Matchersdeclaration shipped indistis identical in 5.0.0 and 5.0.1 (same emitted type chunk), sosrc/vitest-matchers.d.tsis unchanged and the type-check stays clean. Its fixes are elsewhere —expect: correct return value in toMatchAriaSnapshot,fakeTimers: force queueMicrotask/nextTick in toNotFake,types: make public declarations self-contained, plus collection and UI fixes.What vitest 5 required, and what it didn't
clearMocks: truewas already explicit in the config (now redundant, kept for clarity).vitest/outputFile: { junit: './junit.xml' }is explicit, so the report stays where the pipeline reads it. Verified:junit.xmlandcoverage/lcov.infoland in the same paths as before, and no.vitest/directory is createdsequentialin favour ofconcurrent.resolves/.rejects/expect.pollin the suitefrom 'vitest'is importedloupe.inspect→ pretty-format@sinonjs/fake-timerstoFakelist, so no default shifted under itAssertiontype changed,jestnamespace augmentations droppedvitest-fail-on-console(0.10.1) stays compatible: it peers on@vitest/utils, and pnpm keeps a 4.1.11 copy of that package alongside vitest 5 to satisfy it. Verified that it is still armed under vitest 5, with a throwaway test that callsconsole.error— the run fails, as it should.The type-level breaking change
Vitest 5 inlined the
expectpackage. Two consequences:Assertionwent from one type parameter to two, the first being the return type that powers the new promise-aware matcher typing:And more consequentially, matcher augmentations declared against the global
jestnamespace are no longer picked up. That is still how both matcher libraries in this project register:The result:
tsc --noEmitreported 487TS2339errors — everytoBeVisible,toBeInTheDocument,toHaveStyle,toHaveStyleRuleand friend. The runtime was unaffected throughout: all 688 tests passed before and after. The matchers are registered at runtime byexpect.extend, which is untouched; only their type declarations went missing.Both libraries are still at their latest published versions — jest-dom 7.0.1 (2026-08-09) and @emotion/jest 11.14.2 (2025-11-04) — and neither has a fix in progress:
@testing-library/jest-domAssertion<T>augmentation no longer merges with Vitest'sAssertion<R, T>"@emotion/jestneeds triageafter ~3 years. 2 comments, both from users; no maintainer reply, no linked PRThe two halves of the bridge therefore have very different outlooks. jest-dom's side is an active bug against an active repository, affecting everyone migrating, and fixable in a few lines of its own
types/vitest.d.ts— plausibly resolved upstream soon. emotion's side has been an untriaged feature request for three years, on a repository whose main branch has had no commits since 2025-11-04 and whose only recent move in this area was widening the peer range to@types/jest@30.x. Treat thetoHaveStyleRulehalf as indefinite rather than temporary.src/vitest-matchers.d.tsre-declares the matchers on vitest's ownMatchersinterface, which is the supported extension point:It reuses the libraries' own exported types rather than restating any matcher signature, apart from
toHaveStyleRule, whose type emotion does not export separately.This is also the approach the wider community has converged on. The workaround linked from jest-dom #738 is a commit in owid-grapher (2026-09-07) that extends vitest 5's
MatcherswithTestingLibraryMatchersin the same way, arrived at independently. A second report on 2026-09-11 confirms the same shape against vitest 5.0.0 and jest-dom 7.0.1 — 0 type errors, 951 tests passing — and reduces it further by dropping theAsymmetricMatchersContainingblock (TS2320) and theReturnType<ExpectStatic['stringContaining']>alias (TS2310, andanyin vitest 5 anyway); that commenter has offered to open the upstream PR. The only alternative suggested in the issue is@ts-expect-erroron every failing line — 487 of them here. It is a bridge, to be deleted as soon as either library registers on vitest'sMatchers— the comment in the file says so. It stays out of the published surface:tsconfig.lib.jsonbuilds fromfiles: ["src/lib.ts", "src/testing.ts"], this file is a module imported by neither, and the api-extractor report comes out unchanged.The coverage change
Also fixed in 5:
include/excludeglobs were matched too eagerly.**/types/*now means what it says — files directly inside atypes/directory — so nested paths are no longer excluded. One file joins the report:It is not type-only: it exports the runtime type guard
isRawErrorSoapResponse, re-exported throughsrc/types/network/index.tsandsrc/lib.ts, so it is part of the public API. Vitest 4 silently left it unmeasured. It arrives fully covered (FNF:1 FNH:1 LF:1 LH:1), so the totals barely move:I deliberately did not widen the glob to
**/types/**to restore the old exclusion: that would go back to hiding runtime code from coverage. The remaining globs of the same shape (**/tests/*,**/workers/*) have no nested files today, so nothing else changed.Verification
Run locally on Node 22.23.2, against the current
main:pnpm testpnpm test:ci(junit + coverage, as CI runs it)junit.xmlandcoverage/lcov.infoin place, no.vitest/pnpm type-checkpnpm lintpnpm build:pkg(sdk build)pnpm build:lib(api-extractor)soap.tsis the only additionvitest-fail-on-consolestill failing onconsole.errorDiff against main
Three files:
package.json(two lines),pnpm-lock.yaml, and the newsrc/vitest-matchers.d.ts. jsdom 30 (#906) is already onmainand merged in here.Security
Resolves the 5 advisories that were reachable through
viteston the pre-update audit (esbuild,vite,vitest,@vitest/mocker).Noted, not acted on
Vitest 5 prints a hint after each run: the suite spawns 39 isolated workers at ~790ms startup each, and
isolate: falsewould save around 2s by reusing them across files. Worth trying, but it changes test isolation semantics, so it belongs in its own change rather than a dependency bump.🤖 Generated with Claude Code