~/talk

Testing Library: everybody uses it, but nobody understands it

Talkat code.talks 2023 · 2023-09-14..09-15· [testing, frontend-architecture]
slides:none on file

Explains that Testing Library is a cross-framework testing layer: render calls react.client.createRoot into a container, wraps renders in act, returns bound queries and an unmount cleanup that calls root.unmount; Node runs under JSDOM or happy-dom which lack navigation, layout and are slower (querySelector ~4ms) so many DOM queries add up. getByRole builds explicit+implicit selectors, computes accessible name, filters visibility — which makes it slow but accurate. Notes 8.3M weekly downloads for react-testing-library and 12.7M for dom-testing-library, and recommends userEvent over fireEvent.

AI-written summary · about

  1. 0:00Testing Library confusion
  2. 3:43Why Testing Library is misunderstood
  3. 8:20Where components render
  4. 12:09How render works
  5. 13:57What Act does
  6. 16:51getByRole query speed
  7. 26:12FireEvent vs UserEvent
  8. 28:39How a contribution broke the library
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.