-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(cdk/testing): errors in harnesses when using Vitest #32399
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
Conversation
Fixes that we were hitting an error due to the DOM implementation that Vitest is using when constructing events.
ff5b46a to
0d6642c
Compare
| // Passing `window` as the `view` on for events when the environment is using jsdom | ||
| // ends up throwing `member view is not of type Window` (see #32389). Leave it as | ||
| // `undefined` for such cases. | ||
| return typeof window !== 'undefined' && window && !(window as Window & {jsdom?: unknown}).jsdom |
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.
NIT, redundant check
| return typeof window !== 'undefined' && window && !(window as Window & {jsdom?: unknown}).jsdom | |
| return typeof window !== 'undefined' && !(window as Window & {jsdom?: unknown}).jsdom |
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.
The check is there because technically window can be null which is typeof === 'object'.
alan-agius4
left a comment
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.
LGTM, just one NIT
Fixes that we were hitting an error due to the DOM implementation that Vitest is using when constructing events. (cherry picked from commit d41d397)
Fixes that we were hitting an error due to the DOM implementation that Vitest is using when constructing events.
Fixes #32389.