Improve DrawerContent performance (Jest) #8431
Unanswered
MashaSinkevich
asked this question in
Ideas
Replies: 2 comments
-
Same thing happens in Vitest, significant speed increase when DrawerContent, Collapse and ModalContent are mocked to not use transitions |
Beta Was this translation helpful? Give feedback.
0 replies
-
bb
2024年3月20日 上午1:54:38 [GMT+08:00],Bruno Fusieger ***@***.***> 寫道:
…Same thing happens in Vitest, significant speed increase when DrawerContent, Collapse and ModalContent are mocked to not use transitions
--
Reply to this email directly or view it on GitHub:
#8033 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
We have several thousands of
jest
tests and their speed requires improvement.Problem Statement/Justification
During one of the investigations we've found that our slowest tests are related to
Drawer
.When we mocked
DrawerContent
we saw SIGNIFICANT changes on tests running speed on CI:Important to note that we already had
usePrefersReducedMotion
in our mocks so this does not affect the speed.We assume that this could be related to the usage of
framer-motion
.But interesting that if remove animation from
framer-motion
viamotionProps
(at least this override removes it visually if to do this on a real web code) there are no changes in the running speed:Proposed Solution or API
No ideas for now, I will try to look in to it more and maybe I will have ideas.
As far as I can see, the animation is done not via
transition-duration
but via constant recalculation oftransform
values, which potentially gives us this slow speed in Jest:Alternatives
No response
Additional Information
I was not able to find any working solution of how to mock
framer-motion
in Chakra UI so the code which I am showing here is just smth to what I came independently.Sources that I've tried without luck:
#5449
https://dev.to/tmikeschu/mocking-framer-motion-v4-19go
https://github.com/chakra-ui/chakra-ui/blob/main/packages/components/theme/src/foundations/transition.ts (potentially remove transitionDurarion for tests)
Also important to mention that I've tried to mock other places with
framer-motion
but this did not give difference in run time locally (I will list here all variants at once so it would be more compact):Beta Was this translation helpful? Give feedback.
All reactions