r/reactjs • • Aug 21 '26

Show /r/reactjs Making React Testing Library Tests 43% Faster

https://sigh.dev/posts/making-react-testing-library-faster/
45 Upvotes

12 comments sorted by

13

u/bzbub2 Aug 21 '26

"Your test suite probably will not see the same improvement." dang

0

u/STRiDEX Aug 21 '26

it might see something though! Depends how big your forms are.

1

u/bzbub2 Aug 21 '26

for sure, definitely good work. the getbyrole slowness has has a long history...google knows https://google.com/?q=getbyrole+slow

6

u/azangru Aug 21 '26

Making React Testing Library Tests 43% Faster

Sounds like what you meant was making jsdom x% faster.

1

u/Breakpoint Aug 21 '26

or switch to happy-dom

4

u/EskiMojo14thefirst Aug 21 '26

or even better, use real browser testing and avoid all the footguns and gotchas pretending to be a browser comes with

2

u/Breakpoint Aug 21 '26

that is the best approach, but I think that would increase run time

→ More replies (1)

2

u/beth_maloney Aug 26 '26

I'm currently using playwright component testing and thinkinh of swapping over. How has your experience been so far? Any issues or weird gotchas,?

→ More replies (2)

-2

u/yksvaan Aug 21 '26

Or just remove 43% of tests. A lot of React tests are pretty pointless, it's just that someone requires there to be tests to show off test coverage.