-
Notifications
You must be signed in to change notification settings - Fork 33
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
Uncaught exception while using Skeleton Popup #406
Comments
Hi @is-sematell, for better dubugability, would you mind packaging up your reproduction as a repository (or stackblitz or whatever)? Without your Vite config and other setup, I cannot reprodce. Also please see if you can make the reproduction more minimal; e.g. I doubt SvelteKit is in play here, so try to repro without it. Looking at your stacktrace, the error originated from the jsdom library. In my experience, these issues are typically caused by bugs in either jsdom or Svelte itself. As a workaround, you could also try:
|
@mcous Hey, thanks for the prompt response. I've reproduced this issue on Stackblitz with a minimal stack:
Solves the issue 😄 Stackblitz: https://stackblitz.com/edit/vitejs-vite-gnytdg
Also works! Stackblitz fork: https://stackblitz.com/edit/vitejs-vite-ygytdq |
Nice, thank you! Glad to hear that there are workarounds. Folks seem to like happy-dom, though I’ve found it to be a bit buggier in general than jsdom. That being said, the maintainer is super responsive and bugs I’ve filed have been resolved very quickly, so I think it’s a good choice if it works well for your suite. I’ll dig in and see if I can isolate this to something specific in jsdom and follow up here accordingly |
Ok, so unfortunately this looks like a bug in the nwsapi library that jsdom relies on for CSS selector parsing. They've got a few open issues that look like they could be the same issue:
If you are heavily invested in using JSDOM, some users in those threads are recommending forcing a resolution of Gonna poke around a little more, but will likely close this issue as a can't fix, since issues have already been filed with no movement in the relevant repo |
@mcous I see. Thank you so much for looking into it and helping out with some workarounds! |
Summary
I've created a Tooltip component that utilizes Skeleton Popup. It works just fine in the browser.
However, when I try to test it via Testing Library, I get the below error. Seems like it is caused by
userEvent.hover
.I've checked with the Skeleton community, and they believe that this is a Testing Library bug.
Error
Reproduction steps
@sveltejs/vite-plugin-svelte
since it isn't needed for SvelteKit and causes errorswindow.matchMedia
, otherwise it may produce errors: TypeError: window.matchMedia is not a function in Vitest vitest-dev/vitest#821userEvent
for simulating user interaction: https://testing-library.com/docs/user-event/installvitest
Code
Tooltip.svelte
TooltipTest.svelte
Tooltip.test.ts
The text was updated successfully, but these errors were encountered: