mercredi 22 mai 2019

How much faster is shallow rendering than mounting a component

Javascript (actually Typescript) project where tests are written with enzyme. We have 1000+ tests and shallow is not used only once --we always use mount.

Tests are starting to take longer to run, and I know that a good amount of our tests do no require to mount the component. shallow would suffice. In this scenario I ask myself: is it worth to use shallow whenever possible to reduce the amount of time that tests need to run?

I have been looking around, trying to find a quantitative comparison between mount and shallow but have been unable to find such a thing. In other words: if my best scenario is to save 1% of time I will not spend time on this. But if I can speed up my tests by, say, a 20%, then I will probably want to do it.

Do you have any insight into this topic, or know about any quantification on this topic?

TL;DR: I know the difference between mount and shallow. I know that shallow is faster than mount. The question is how much faster is shallow in comparison to mount (depends on many things... I am talking about some estimates)

Aucun commentaire:

Enregistrer un commentaire