New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed - 'Name:' field always blank for getByRole #267
Comments
Hi! Haven't had the chance to try out the vite+vitest+happy-dom+VTL combination, but I don't think there should be an issue using thanks! |
Hmm, that's not good (for me) https://github.com/DGollings/happy-dom-vitest-example It works :), so question would be, why doesn't it for me. My real project is of course much more complex, an easy start is to compare dependency versions in package.json. Where else would you suggest I look? |
Updated all my real dependencies to match the versions in happy-dom-vitest "dependencies": { And it works :) So one of these versions, although none of the obvious to me candidates worked when I tried a couple (happy-dom, testing-library/vue and /dom) made it not work, not even after reverting the change (didn't nuke Anyway, I'll change the title to something easier to search for anyone with a similar issue. And the solution seems simple, update your dependencies. Thanks |
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 :)
The text was updated successfully, but these errors were encountered: