[experiment] stub matchMedia global#90
Conversation
WalkthroughAdds Vitest setup files with window.matchMedia mocking across 11 projects (apps and integrations) to enable consistent test environment behavior. Updates corresponding vite.config.ts and setupTests.js files to reference these setup modules and reorders imports for consistency. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Everyone who uses recharts will see the same problem. Should we handle it in the library instead? Just fallback to animation false if we can't find this method. |
|
its a "normal" testing issue, cause to the fact that jsdom does not mock But yeah, maybe jsdom should support it? That said, now that you made me notice it, I'm in doubt, it may.. work also as you are proposing? It would make things more opaque maybe, and what if the end developer really wants to stub Dunno I'm open on the topic, maybe we should check whats other libraries approach on the topic 🤔 |
|
Normal or not, if we do this then we force everyone (who is testing Recharts) to write a mock that defaults to "return false". We could save them this trouble and default to "return false" directly in the library if we detect the absence of |
Related PR: recharts/recharts#6956
Summary by CodeRabbit
Tests
Chores