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
I am seeing the following errors when running Jest tests using the latest version of HeadlessUI:
TypeError: node.getAnimations is not a function
at waitForTransition (../../node_modules/@headlessui/react/dist/headlessui.dev.cjs:3752:26)
at ../../node_modules/@headlessui/react/dist/headlessui.dev.cjs:3739:13
It looks like the changes made on L236 in #3452 introduced a bug.
The text was updated successfully, but these errors were encountered:
This should be fixed by #3473, and will be available is available in the latest release.
The issue is that we rely on Element.prototype.getAnimations(…) which is a browser feature that's available in browsers since 2020. Unfortunately, jsdom is not up to date and therefore it crashes.
To solve this, we ship with a very minimal polyfill, just enough to run the tests. However, we do show a warning now that guides you to using a polyfill to silence the warnings.
I would also recommend to:
Try and move to real browser tests (e.g.: Playwright)
The above fix will error in environments where Element is not defined (for instance, when using react-test-renderer). Would it be possible to guard that polyfill with an is-defined check — as long one is only constructing the vdom (rather than actual HTML nodes), we shouldn't ever need it.
What package within Headless UI are you using?
For example: @headlessui/react
What version of that package are you using?
For example: v2.1.6
What browser are you using?
N/A
Describe your issue
I am seeing the following errors when running Jest tests using the latest version of HeadlessUI:
It looks like the changes made on L236 in #3452 introduced a bug.
The text was updated successfully, but these errors were encountered: