-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Wrong DOM dimensions after call to mount #1434
Comments
It's not that enzyme is broken; This looks like a minimal test case - can you provide your actual code, so we can see what you're trying to test? Generally you shouldn't need the DOM node. |
I'm having a similar issue myself where Component
However, when mounting the component and simulating a prop change, the Unit Test
I'm not entirely convinced that enzyme is the cause of this since it feels like its related to the underlying tooling or even JSDOM, but I suspect you've far more experience than I with |
@michaelpapworth I agree that it's likely related to jsdom. Have you tried running enzyme in an actual browser to confirm? |
Do you use JSDOM in enzyme? We had tons of problems with it before, so we switched to running the actual browser with My mocha test setup looks as following:
|
Yes, we use jsdom with enzyme and it works fine. However, we don't test for things like In other words, I'm suggesting that's not a good or useful test. |
In my case I test the visual component that sets the proper visual presentation. The component itself uses |
enzyme isn’t an appropriate visual testing tool; I’d recommend something like happo for that (for visual diffs). Separately, all you need to test there is that you rendered a div with a style height of 100; the clientHeight is guaranteed there because of how React and the DOM work - so all you’d need to do is assert on the style. |
@ljharb makes sense! Thank you! 🙏 |
DOM dimensions are invalid after call to
mount()
:Running the same in browser works:
Adding timeout after mount doesn't help either. It seems that enzyme is broken. I use electron-mocha to run tests in native environment.
The text was updated successfully, but these errors were encountered: