You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/config/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1664,7 +1664,7 @@ Will call [`vi.unstubAllGlobals`](/api/vi#vi-unstuballglobals) before each test.
1664
1664
1665
1665
-**Type:**`PrettyFormatOptions`
1666
1666
1667
-
Format options for snapshot testing. These options are passed down to [`pretty-format`](https://www.npmjs.com/package/pretty-format).
1667
+
Format options for snapshot testing. These options are passed down to our fork of [`pretty-format`](https://www.npmjs.com/package/pretty-format). In addition to the `pretty-format` options we support `printShadowRoot: boolean`.
1668
1668
1669
1669
::: tip
1670
1670
Beware that `plugins` field on this object will be ignored.
### Snapshots using custom elements print the shadow root
277
+
278
+
In Vitest 4.0 snapshots that include custom elements will print the shadow root contents. To restore the previous behavior, set the [`printShadowRoot` option](/config/#snapshotformat) to `false`.
279
+
280
+
```js
281
+
// before Vite 4.0
282
+
exports[`custom element with shadow root 1`] =`
283
+
"<body>
284
+
<div>
285
+
<custom-element />
286
+
</div>
287
+
</body>"
288
+
`
289
+
290
+
// after Vite 4.0
291
+
exports[`custom element with shadow root 1`] =`
292
+
"<body>
293
+
<div>
294
+
<custom-element>
295
+
#shadow-root
296
+
<span
297
+
class="some-name"
298
+
data-test-id="33"
299
+
id="5"
300
+
>
301
+
hello
302
+
</span>
303
+
</custom-element>
304
+
</div>
305
+
</body>"
306
+
`
307
+
```
308
+
276
309
### Deprecated APIs are Removed
277
310
278
311
Vitest 4.0 removes some deprecated APIs, including:
0 commit comments