Creating Snapshots

Learn how to create a snapshot for snapshot testing.

Managing the snapshot

After writing a snapshot test, Jest will create the snapshot on the first run and store it for future reference. Snapshots should be committed to any version control systems being used, such as GitHub or GitLabs. Because they represent the expected current element tree making up a user interface, all developers need to be referencing the same tree to accurately know whether or not their current tree passes the test.

Additional tooling

An additional package is required to write snapshot tests, and different client-side frameworks require different packages to do so. A list is included below for the three most popular client-side frameworks, but we are referencing React’s ...