-
Notifications
You must be signed in to change notification settings - Fork 550
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
Autocomplete breaks in tests run with jsdom and vitest #2454
Comments
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days. |
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days. |
This is likely due to using an old version of If in doubt, in future, please update to the latest version of jsdom as it'll likely fix issues like this. |
makese sense. IIRC that wasn't an option at the time we opened this |
Description
This issue may better exist on primer/behaviors (or even upstreamed to jsdom if we can repro simply enough)
Initially reported in slack by @itsbagpack
https://github.slack.com/archives/C01L618AEP9/p1666186967969609
👋:skin-tone-2: hi friends, i’m running into some testing issues around using the Autocomplete component and i was wondering what we were missing
for context, here’s the PR we’re working with: https://github.com/github/delorean/pull/127
It appears that jsdom is throwing when trying to add an event listener, and appears that's due to the primer/behaviors
focusZone
attempting to pass a signal, which appears to conflict with the accepted signal jsdom expects. I addedPrimer/react uses JSDOM (with jsdom) to test this component, which is confusing to me, given there's no indication that it currently has issues here
This leads me to think either
a version of JSDOM begins breaking
vite and jest somehow differ in the globals they send to jsdom in this scenario
I suggested a workaround, temporarily, mocking
focusZone
entirely -but this changes behavior of the autocomplete, and is not ideal
Steps to reproduce
start a project with vite/vitest
render an AutoComplete in a test using the jsdom environment
see jsdom throw
Version
All related versions of multiple packages
It's unclear to me whether this problem already exists and is becoming clear due to versioning of react and testing-libary, is due to something with how vite interops globals compared to jest, or if this is jest/jsdom.
Browser
No response
The text was updated successfully, but these errors were encountered: