Test Enzyme Rendered Components with Jest Snapshots

Tyler Clark
InstructorTyler Clark

Share this video with your friends

Send Tweet

In this lesson we will utilize Jest's snapshot testing to make sure our component's rendered output stays consistent. Unit testing the component elements can take us far, however sometimes it is helpful to test the entire component interface.

Krishna Pradhan
Krishna Pradhan
~ 3 years ago

Hi Tyler after adding the npm "enzyme-to-json"

the test suite failed with this message Cannot find module 'enzyme-adapter-react-16' from 'App.test.js'

Damian Joniec
Damian Joniec
~ 2 years ago

My snapshot looks like that, not like yours full of text , is that correct: // Jest Snapshot v1, https://goo.gl/fbAQLP

exports[<App /> matches the snapshot 1] = ShallowWrapper {};

Ahmed Soliman
Ahmed Soliman
~ a year ago

Can we use .debug() from enzyme instead of enzyme-to-json ?