-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Mocking matchMedia #103
Comments
Got it working using |
Thanks @antfu! |
Unfortunately, it's not working yet, but I'll open a PR to address the issue. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Currently I think that there is no way to mock some window methods like matchMedia because of the way that the jsdom env works: https://github.com/antfu-sponsors/vitest/blob/67fecfbf81f5e4be75e973e3655a3ae351a2afb7/src/env/jsdom.ts#L23
It would be great if we could do something like this: https://github.com/wtchnm/vitest-example/blob/194c4f71f8f07f33bb464d5e78be056aecc7c07b/src/__tests__/App.tsx#L5
The text was updated successfully, but these errors were encountered: