Skip to content

Commit 9d37eb3

Browse files
committed
Explain example
1 parent 1b2f198 commit 9d37eb3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

e2e/custom-inline-snapshot-matchers/__tests__/asynchronous.test.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const {toMatchInlineSnapshot} = require('jest-snapshot');
99
expect.extend({
1010
async toMatchObservationInlineSnapshot(fn, ...args) {
1111
this.error = new Error();
12+
// This specific behavior can be implemented without a custom matcher.
13+
// In a real example one might want to observe some global value that `fn()` is affecting.
14+
// The difference between before and after `fn()` might then be persisted as a snapshot.
1215
const result = await fn();
1316

1417
return toMatchInlineSnapshot.call(this, result, ...args);

0 commit comments

Comments
 (0)