-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Error with Enzyme mount "Right-hand side of 'instanceof' is not an object" #1249
Comments
FIXUpdate: I was able to fix this by adding below line to my setupTests.js file
Note: I use Array here since I'm sure I'm not using SVGs as my handler elements and because I know an element cannot be of type Array. A custom type can also be used. Explanation This is the failing code:
Throws error since Enzyme's window.SVGElement = undefined I think this should be added to the docs in order to prevent other people from having this issue. |
Could we do something on our end to prevent people getting this issue? |
@alexreardon Maybe documenting this in the common setup issues section could help. |
Maybe we could do this:
// Some environments do not have the SVGElement constructor
if(!getWindowFromEl(el).SVGElement) {
return;
}
…On Fri, Apr 12, 2019 at 8:07 AM Adonai ***@***.***> wrote:
@alexreardon <https://github.com/alexreardon> Maybe documenting this in
the common setup issues section could help.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1249 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACFN7XZ9hz_0FyhD4XJd1VtqKSLG_vj8ks5vf7IMgaJpZM4cqyYQ>
.
|
Bug or feature request?
Bug
Expected behavior
Component should be successfully mounted using Enzyme and test should pass.
The component itself renders with no issues.
Actual behavior
react-beautiful-dnd throws error when trying to mount it using Enzyme's mount.
Steps to reproduce
Clone provided repo, install dependencies and run tests with
npm test
What version of
React
are you using?16.4.0
(also happens with 16.8.0)
What version of
react-beautiful-dnd
are you running?10.1.1
(also happens with 11.0.0-beta.3)
Demo
I wasn't able to run jest tests on codesandbox but here's a repo
https://github.com/hawkeng/react-beautiful-dnd-enzyme-issue
Also possibly related issue
The text was updated successfully, but these errors were encountered: