@vitest/pretty-format
is not compatible with React 19 snapshots
#6908
Labels
@vitest/pretty-format
is not compatible with React 19 snapshots
#6908
Describe the bug
Since v2.0.2 and this PR #6077, Vitest uses
@vitest/pretty-format
which bundlesreact-is
from React 18, but this doesn't support formatting React 19's element.Previously it was possible to overrides
react-is
to pin React 19 version like other React depsreact
,react-dom
, andreact-server-dom-webpack
and it's common to do so.Not sure what would be the solution. We can try bundling
react-is
both from 18 and 19 and switch during runtime?Reproduction
I found the issue on my repo hi-ogawa/vite-plugins#660, which is using pnpm override like this https://github.com/hi-ogawa/vite-plugins/blob/ca3f97ec09c2549d98779acbf9a24e97706c125d/package.json#L43-L46
Stackblitz repro
On latest Vitest https://stackblitz.com/edit/vitest-dev-vitest-a6zqtz?file=test%2Frepro.test.tsx
On Vitest v2.0.1 https://stackblitz.com/edit/vitest-dev-vitest-rrglpy?file=test%2Frepro.test.tsx
System Info
(stackblitz) System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vitest: 2.1.5 => 2.1.5
Used Package Manager
npm
Validations
The text was updated successfully, but these errors were encountered: