-
Notifications
You must be signed in to change notification settings - Fork 661
Fix: Vitest, the "window.getComputedStyle" error is not defined when running tests #31987
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
Fix: Vitest, the "window.getComputedStyle" error is not defined when running tests #31987
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a Vitest compatibility issue where window.getComputedStyle errors are not handled gracefully in the readThemeMarker function. The fix adds a catch block to return null when getComputedStyle throws an error, preventing test failures in environments like Vitest where this method may not be fully implemented.
Key Changes:
- Added error handling to
readThemeMarker()function in themes.ts to catch and handlegetComputedStyleerrors - Added test coverage for the new error handling behavior
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/devextreme/js/__internal/ui/themes.ts | Added catch block to readThemeMarker() to gracefully handle getComputedStyle errors by returning null |
| packages/devextreme/testing/tests/DevExpress.ui/themes.tests.js | Added two new tests to verify error handling when getComputedStyle throws errors |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
…ivanyandev/DevExtreme into fix/vitest-get-computed-style
No description provided.