getComputedStyle calls slow down jest tests #30763
Unanswered
rocketBANG
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, I'm starting to migrate a project from V8 to V9 and have noticed my test speed has decreased greatly, specifically for tests that are using
Menu
s (the project uses react testing library and jest)Debugging jest I see most of the time is taken up by the detectOverflow function which goes up the ancestors tree calling
getComputedStyle
It seems to perform fine in the browser but in tests using
jest-dom
it appears to be very slowTo try and improve performance I ended up mocking out the fluent
usePositioning
hook to a fake implementation to not have this overhead. (which doesn't seem to affect testing since it's headless anyway)I'm wondering if this is the best approach or there is some other way to deal with the slow tests and if any others have run into the same issue
Beta Was this translation helpful? Give feedback.
All reactions