Skip to content

Commit ca3f616

Browse files
authored
docs(snapshot): specify how to disable prettier
jestjs#7792 suggests that Prettier is optional, but I assumed that all I needed to do was remove `prettier` from my dependencies. That still results in Jest trying to require `prettier`, causing Jest to fail. Took awhile to learn I needed to set `prettierPath` to `null` or `''`, so I added this to the docs.
1 parent a2f1700 commit ca3f616

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

docs/SnapshotTesting.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,8 @@ it('renders correctly', () => {
134134

135135
That's all there is to it! You can even update the snapshots with `--updateSnapshot` or using the `u` key in `--watch` mode.
136136

137+
By default, Jest uses Prettier to format inline snapshots. To disable this, set `prettierPath: null` in the config.
138+
137139
### Property Matchers
138140

139141
Often there are fields in the object you want to snapshot which are generated (like IDs and Dates). If you try to snapshot these objects, they will force the snapshot to fail on every run:

0 commit comments

Comments
 (0)