Jest 14.0: React Tree Snapshot Testing · Jest

  • For Facebook’s native apps we use a system called “snapshot testing”: a snapshot test system that renders UI components, takes a screenshot and subsequently compares a recorded screenshot with changes made by an engineer.
  • As a result many people stopped writing tests altogether which eventually led to instabilities.
  • With snapshot testing I do not need the output files, the snapshots are generated for free by Jest!
  • Engineers frequently told us that they spend more time writing a test than the component itself.
  • import renderer from ‘react/lib/ReactTestRenderer’ ; test ( ‘Link renders correctly’ , ( ) = > { const tree = renderer .

Read the full article, click here.


@cpojer: “Jest 14.0: React Snapshot Testing, experimental React-Native support and future plans for Jest. Try it out now!”


One of Jest’s philosophies is to provide an integrated “zero-configuration” experience. We want to make it as frictionless as possible to write good tests that are useful. We observed that when engineers are provided with ready-to-use tools, they end up writing more tests, which in turn results in stable and healthy code bases.


Jest 14.0: React Tree Snapshot Testing · Jest