(received, propertiesOrHint, hint)
| 158 | Context, |
| 159 | [propertiesOrHint?: object | string, hint?: string] |
| 160 | > = function (received, propertiesOrHint, hint) { |
| 161 | const matcherName = class="st">'toMatchSnapshot'; |
| 162 | let properties; |
| 163 | |
| 164 | const length = arguments.length; |
| 165 | if (length === 2 && typeof propertiesOrHint === class="st">'string') { |
| 166 | hint = propertiesOrHint; |
| 167 | } else if (length >= 2) { |
| 168 | if (typeof propertiesOrHint !== class="st">'object' || propertiesOrHint === null) { |
| 169 | const options: MatcherHintOptions = { |
| 170 | isNot: this.isNot, |
| 171 | promise: this.promise, |
| 172 | }; |
| 173 | let printedWithType = printWithType( |
| 174 | class="st">'Expected properties', |
| 175 | propertiesOrHint, |
| 176 | printExpected, |
| 177 | ); |
| 178 | |
| 179 | if (length === 3) { |
| 180 | options.secondArgument = class="st">'hint'; |
| 181 | options.secondArgumentColor = BOLD_WEIGHT; |
| 182 | |
| 183 | if (propertiesOrHint == null) { |
| 184 | printedWithType += |
| 185 | class="st">"\n\nTo provide a hint without properties: toMatchSnapshot('hint')"; |
| 186 | } |
| 187 | } |
| 188 | |
| 189 | throw new Error( |
| 190 | matcherErrorMessage( |
| 191 | matcherHint(matcherName, undefined, PROPERTIES_ARG, options), |
| 192 | `Expected ${EXPECTED_COLOR(class="st">'properties')} must be an object`, |
| 193 | printedWithType, |
| 194 | ), |
| 195 | ); |
| 196 | } |
| 197 | |
| 198 | class="cm">// Future breaking change: Snapshot hint must be a string |
| 199 | class="cm">// if (arguments.length === 3 && typeof hint !== class="st">'string') {} |
| 200 | |
| 201 | properties = propertiesOrHint; |
| 202 | } |
| 203 | |
| 204 | return _toMatchSnapshot({ |
| 205 | context: this, |
| 206 | hint, |
| 207 | isInline: false, |
| 208 | matcherName, |
| 209 | properties, |
| 210 | received, |
| 211 | }); |
| 212 | }; |
| 213 | |
| 214 | export const toMatchInlineSnapshot: MatcherFunctionWithContext< |
| 215 | Context, |
nothing calls this directly
no test coverage detected