by Danny Bell
Here’s a riddle: where should you unit test your React components?
The browser is an OK choice. It’s probably “easy,” in that you are already writing browser-targeted code. But for unit tests that are going to be run thousands of times, you lose a lot of cycles moving pixels around.
Well, alright, you could run them on NodeJS. React has a TestRenderer utility letting you render a self-contained component tree, independent of any DOM.