Description
DOM Testing Library
version: 6.8.1node
version: v12.6.0
I apologize in advance for not following the issue template; I'm not sure it serves performance discussion well.
We are in the progress of migrating the test suite of Material-UI from enzyme shallow + mount API to testing-library. However, we have hit a roadblock (we should consider what we do with this block, do we force our way in, move around it, etc?). While the test suite takes about 14s to run on v3, it now takes about 70s (on my machine). It's a x5 increase. Diving more into the issue, I could identify this problem:
Once we aggregate all the data, we realize that we indeed spend most of our time in this function:
So it seems that the numerous calls to window.getComputedStyle()
are using +65% of the available CPU resources. If we run the same tests in a chrome headless, the performance are much better, about 20s instead of 70s.
So my question is, do we have a viable workaround? In the case of Material-UI, we have migrated about 28% of our tests. If I extrapolate, once we hit 100%, our unit tests will take about 4 minutes (to be compared with ~14s in v3). Should we do something about it? If yes, what options do we have? Thank you!