Skip to content

Commit 01c17f8

Browse files
committed
docs(snapshot): inline snapshots can be used without prettier
1 parent 711b602 commit 01c17f8

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

docs/SnapshotTesting.md

+4-8
Original file line numberDiff line numberDiff line change
@@ -99,18 +99,14 @@ Once you're finished, Jest will give you a summary before returning back to watc
9999

100100
Inline snapshots behave identically to external snapshots (`.snap` files), except the snapshot values are written automatically back into the source code. This means you can get the benefits of automatically generated snapshots without having to switch to an external file to make sure the correct value was written.
101101

102-
> Inline snapshots are powered by [Prettier](https://prettier.io). To use inline snapshots you must have `prettier` installed in your project. Your Prettier configuration will be respected when writing to test files.
103-
>
104-
> If you have `prettier` installed in a location where Jest can't find it, you can tell Jest how to find it using the [`"prettierPath"`](./Configuration.md#prettierpath-string) configuration property.
105-
106102
**Example:**
107103

108104
First, you write a test, calling `.toMatchInlineSnapshot()` with no arguments:
109105

110106
```tsx
111107
it('renders correctly', () => {
112108
const tree = renderer
113-
.create(<Link page="https://prettier.io">Prettier</Link>)
109+
.create(<Link page="https://example.com">Example Site</Link>)
114110
.toJSON();
115111
expect(tree).toMatchInlineSnapshot();
116112
});
@@ -121,16 +117,16 @@ The next time you run Jest, `tree` will be evaluated, and a snapshot will be wri
121117
```tsx
122118
it('renders correctly', () => {
123119
const tree = renderer
124-
.create(<Link page="https://prettier.io">Prettier</Link>)
120+
.create(<Link page="https://example.com">Example Site</Link>)
125121
.toJSON();
126122
expect(tree).toMatchInlineSnapshot(`
127123
<a
128124
className="normal"
129-
href="https://prettier.io"
125+
href="https://example.com"
130126
onMouseEnter={[Function]}
131127
onMouseLeave={[Function]}
132128
>
133-
Prettier
129+
Example Site
134130
</a>
135131
`);
136132
});

0 commit comments

Comments
 (0)