Skip to content

Fixed - 'Name:' field always blank for getByRole #267

Closed
@DGollings

Description

@DGollings

I'm, like most people, new to Vite/Vitest and personally new to testing using the DOM

if you read the manual it states here how to configure your environment
https://vitest.dev/guide/features.html#mocking
in particular this line environment: 'happy-dom', // or 'jsdom', 'node'
it states, albeit implicitly, that happy-dom is the default for Vitest

I've spent the past week working around (and wondering why) getByRole never worked. And by never worked I don't mean something like a big exception. Just subtle, shows you the options, what it sees, etc. But Name: was always blank.

I've just now figured out that environment needs to be jsdom for testing using getByRole. A warning somewhere, in docs or runtime, would have been nice :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions