happy-dom
happy-dom copied to clipboard
Cannot read properties of undefined (reading 'getRootNode')
Hi there 👋🏻 ,
I hope it is the right place to ask, and I apologize if not. I'm currently trying to bump version of happy-dom from 2.51.0
to a greater one using vitest
& vue 3
but I'm facing the following error:
happy-dom version: 3.1.0
(I've tried multiple version between this one and 2.51.0
)
vitest version: 0.10.0
It seems to be related to usage of @headlessui/vue
(version 1.5.0
) but I haven't found yet the root cause.
Thanks in advance for your help, wish you a nice day ☀️
Thank you for reporting @smarlhens! :slightly_smiling_face:
It might be a bug as a change was made on that part of the code in v2.51.1.
I will investigate what may have caused it.
Hey! I'm also running into issues with this using vitest and react with happy-dom 3.1.1
in my case it seems like it might be related to certain components from the mui component library
@WonderPanda you don't happen to have a open project that I can test in? :slightly_smiling_face:
I'm facing the same error while using a remix
template with vitest
. You can check out this repo and run the following to reproduce it:
-
npm i
-
npm run test
It should fail with the following error message:
The test is located in this file.
Somehow it's only possible to run the first test without errors although both tests are identical. I'm also not 100% sure if this a problem with happy-dom
testing-library
or vitest
. But the error messages links the error to happy-dom
.
Thanks in advance for any feedback and for your support!!!
Here is a codesandbox with the minimal possible code to produce this error. Indeed, it only happens when running a second test (when adding a .only
to the second test, it does not happen).
I can confirm this is related to happy-dom
. I changed the vitest
environment to jsdom
, and all tests passed.
In my case, it also happens when running a second test.
I'm blocked by this as well in [email protected] Reproducible example: https://stackblitz.com/edit/vitest-dev-vitest-ktnq7h
Thanks for reporting @smarlhens! 🙂
I am sorry that it has taken such a long time for me to fix this. It has been a lot going on in my private and work life, but now I will have time to focus on Happy DOM again.
I have made a fix. Hopefully it will solve your problem. Feel free to re-open otherwise.
You can read more about the related releases here: https://github.com/capricorn86/happy-dom/releases/tag/v7.5.10 https://github.com/capricorn86/happy-dom/releases/tag/v7.5.9