(
key: string,
receivedSerialized: string,
options: {isInline: boolean; error?: Error},
)
| 109 | } |
| 110 | |
| 111 | private _addSnapshot( |
| 112 | key: string, |
| 113 | receivedSerialized: string, |
| 114 | options: {isInline: boolean; error?: Error}, |
| 115 | ): void { |
| 116 | this._dirty = true; |
| 117 | if (options.isInline) { |
| 118 | // eslint-disable-next-line unicorn/error-message |
| 119 | const error = options.error || new Error(); |
| 120 | const lines = getStackTraceLines( |
| 121 | removeLinesBeforeExternalMatcherTrap(error.stack || ''), |
| 122 | ); |
| 123 | const frame = getTopFrame(lines); |
| 124 | if (!frame) { |
| 125 | throw new Error( |
| 126 | "Jest: Couldn't infer stack frame for inline snapshot.", |
| 127 | ); |
| 128 | } |
| 129 | this._inlineSnapshots.push({ |
| 130 | frame, |
| 131 | snapshot: receivedSerialized, |
| 132 | }); |
| 133 | } else { |
| 134 | this._snapshotData[key] = receivedSerialized; |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | clear(): void { |
| 139 | this._snapshotData = this._initialData; |
no test coverage detected