Skip to content

toMatchAriaInlineSnapshot cannot match empty aria trees #10158

@mrginglymus

Description

@mrginglymus

Describe the bug

Thanks for adding this into core vitest! In the process of switching from my own implementation I've found that vitest's is unable to assert on an empty aria document:

<button aria-hidden="true">Hidden</button>

as

expect(document.body).toMatchAriaInlineSnapshot('');

is intepreted as being a 'fill this in later' call. I think I also encountered an issue with the non-inline variation where an empty string was not considered a valid yaml document.

Reproduction

https://github.com/vitest-dev/vitest/compare/main...mrginglymus:vitest:empty-aria?expand=1

System Info

System:
    OS: Linux 6.6 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (24) x64 Intel(R) Core(TM) i9-10920X CPU @ 3.50GHz
    Memory: 30.00 GB / 31.24 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 22.15.1 - /home/bill/.nvm/versions/node/v22.15.1/bin/node
    npm: 10.9.2 - /home/bill/.nvm/versions/node/v22.15.1/bin/npm
    pnpm: 10.31.0 - /home/bill/.nvm/versions/node/v22.15.1/bin/pnpm
  npmPackages:
    @vitejs/plugin-basic-ssl: ^2.1.4 => 2.1.4
    @vitest/browser: workspace:* => 4.1.4
    @vitest/browser-playwright: workspace:* => 4.1.4
    @vitest/browser-preview: workspace:* => 4.1.4
    @vitest/browser-webdriverio: workspace:* => 4.1.4
    @vitest/bundled-lib: link:./bundled-lib => undefined
    @vitest/cjs-lib: link:./cjs-lib => undefined
    playwright: catalog: => 1.59.0
    vitest: workspace:* => 4.1.4
    vitest-browser-react: ^2.0.5 => 2.0.5

Used Package Manager

pnpm

Validations

Metadata

Metadata

Assignees

Labels

p3-minor-bugAn edge case that only affects very specific usage (priority)

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions