(received, propertiesOrSnapshot, inlineSnapshot)
| 215 | Context, |
| 216 | [propertiesOrSnapshot?: object | string, inlineSnapshot?: string] |
| 217 | > = function (received, propertiesOrSnapshot, inlineSnapshot) { |
| 218 | const matcherName = 'toMatchInlineSnapshot'; |
| 219 | let properties; |
| 220 | |
| 221 | const length = arguments.length; |
| 222 | if (length === 2 && typeof propertiesOrSnapshot === 'string') { |
| 223 | inlineSnapshot = propertiesOrSnapshot; |
| 224 | } else if (length >= 2) { |
| 225 | const options: MatcherHintOptions = { |
| 226 | isNot: this.isNot, |
| 227 | promise: this.promise, |
| 228 | }; |
| 229 | if (length === 3) { |
| 230 | options.secondArgument = SNAPSHOT_ARG; |
| 231 | options.secondArgumentColor = noColor; |
| 232 | } |
| 233 | |
| 234 | if ( |
| 235 | typeof propertiesOrSnapshot !== 'object' || |
| 236 | propertiesOrSnapshot === null |
| 237 | ) { |
| 238 | throw new Error( |
| 239 | matcherErrorMessage( |
| 240 | matcherHint(matcherName, undefined, PROPERTIES_ARG, options), |
| 241 | `Expected ${EXPECTED_COLOR('properties')} must be an object`, |
| 242 | printWithType( |
| 243 | 'Expected properties', |
| 244 | propertiesOrSnapshot, |
| 245 | printExpected, |
| 246 | ), |
| 247 | ), |
| 248 | ); |
| 249 | } |
| 250 | |
| 251 | if (length === 3 && typeof inlineSnapshot !== 'string') { |
| 252 | throw new Error( |
| 253 | matcherErrorMessage( |
| 254 | matcherHint(matcherName, undefined, PROPERTIES_ARG, options), |
| 255 | 'Inline snapshot must be a string', |
| 256 | printWithType('Inline snapshot', inlineSnapshot, serialize), |
| 257 | ), |
| 258 | ); |
| 259 | } |
| 260 | |
| 261 | properties = propertiesOrSnapshot; |
| 262 | } |
| 263 | |
| 264 | return _toMatchSnapshot({ |
| 265 | context: this, |
| 266 | inlineSnapshot: |
| 267 | inlineSnapshot === undefined |
| 268 | ? undefined |
| 269 | : stripAddedIndentation(inlineSnapshot), |
| 270 | isInline: true, |
| 271 | matcherName, |
| 272 | properties, |
| 273 | received, |
| 274 | }); |
nothing calls this directly
no test coverage detected