Slide 52
Slide 52 text
// ...
const toMatchSnapshot = function(received: any, testName?: string) {
this.dontThrow && this.dontThrow();
const {currentTestName, isNot, snapshotState}: MatcherState = this;
if (isNot) {
throw new Error('Jest: `.not` cannot be used with
`.toMatchSnapshot()`.');
}
if (!snapshotState) {
throw new Error('Jest: snapshot state must be initialized.');
}
const result = snapshotState.match(
testName || currentTestName || '',
received,
);