And another visit to London and the amazing React Advanced conference, where I announced @testing-library/react-render-stream to the world.

Beyond React Testing Library: Testing React Libraries (and library-like code)

Abstract (click to expand)

When it comes to testing library code, the (usually amazing!) “Testing Library” approach quickly hits its limitations: We often need to test hot code paths to ensure additional guarantees, such as a specific order of DOM changes or a particular number of renders.

As soon as we start adding Suspense to the picture, it even gets almost philosophical:

  • How do we count a render that immediately suspended, and how do we distinguish it from a “committed” render?

  • How do we know which parts of the Component tree rerendered?

In the Apollo Client code base, we’re using the React Profiler to create a stream of render events, enabling us to switch to a new stream-based testing method.

After testing this approach internally for a year, we have released it in a library that we want to present to the world.