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
ARIA snapshots let you test the accessibility structure of your pages. Instead of asserting against raw HTML or visual output, you assert against the accessibility tree — the same structure that screen readers and other assistive technologies use.
The `meta` field in each assertion result can be filtered via the `filterMeta` reporter option. It receives the key and value of each field and should return a falsy value to exclude the field from the report:
431
428
432
429
```ts
@@ -440,9 +437,7 @@ export default defineConfig({
440
437
},
441
438
})
442
439
```
443
-
444
-
### HTML Reporter
445
-
>>>>>>> 5755951bae9c1f29ead80a0df48c81f2d0a46248
440
+
### HTML 报告器 {#html-reporter}
446
441
447
442
生成 HTML 文件,通过交互式 [GUI](/guide/ui) 查看测试结果。文件生成后,Vitest 将保持本地开发服务器运行,并提供一个链接,以便在浏览器中查看报告。
ARIA snapshots capture the accessibility tree of a DOM element and compare it against a stored template. Based on [Playwright's ARIA snapshots](https://playwright.dev/docs/aria-snapshots), they provide a semantic alternative to visual regression testing — asserting structure and meaning rather than pixels.
See the dedicated [ARIA Snapshots guide](/guide/browser/aria-snapshots) for syntax details, retry behavior in Browser Mode, and file vs. inline snapshot examples. See [`toMatchAriaSnapshot`](/api/expect#tomatcharisnapshot) and [`toMatchAriaInlineSnapshot`](/api/expect#tomatchariainlinesnapshot) for the full API reference.
161
158
162
-
## Custom Serializer
163
-
>>>>>>> 5755951bae9c1f29ead80a0df48c81f2d0a46248
159
+
## 自定义序列化器 {#custom-serializer}
164
160
165
161
你可以添加自己的逻辑来修改快照的序列化方式。像 Jest 一样,Vitest 默认有内置的 JavaScript 类型、HTML 元素、ImmutableJS 和 React 元素提供了默认的序列化程序。
166
162
@@ -327,10 +323,7 @@ declare module 'vitest' {
327
323
::: tip
328
324
See [Extending Matchers](/guide/extending-matchers) for more on `expect.extend` and custom matcher conventions.
Custom serializers control how values are _rendered_ into snapshot strings, but comparison is still string equality. A **domain snapshot adapter** goes further: it owns the entire comparison pipeline for a custom matcher, including how to capture a value, render it, parse a stored snapshot, and match them semantically.
@@ -517,8 +510,7 @@ test('user data inline', () => {
0 commit comments