(spy: MockInstance, msg: string, showActualCall?: any)
| 1216 | } |
| 1217 | |
| 1218 | function formatCalls(spy: MockInstance, msg: string, showActualCall?: any) { |
| 1219 | if (spy.mock.calls.length) { |
| 1220 | msg += c.gray( |
| 1221 | `\n\nReceived:\n\n${spy.mock.calls |
| 1222 | .map((callArg, i) => { |
| 1223 | let methodCall = c.bold( |
| 1224 | ` ${ordinal(i + 1)} ${spy.getMockName()} call:\n\n`, |
| 1225 | ) |
| 1226 | if (showActualCall) { |
| 1227 | methodCall += diff(showActualCall, callArg, { |
| 1228 | omitAnnotationLines: true, |
| 1229 | }) |
| 1230 | } |
| 1231 | else { |
| 1232 | methodCall += stringify(callArg) |
| 1233 | .split('\n') |
| 1234 | .map(line => ` ${line}`) |
| 1235 | .join('\n') |
| 1236 | } |
| 1237 | |
| 1238 | methodCall += '\n' |
| 1239 | return methodCall |
| 1240 | }) |
| 1241 | .join('\n')}`, |
| 1242 | ) |
| 1243 | } |
| 1244 | msg += c.gray( |
| 1245 | `\n\nNumber of calls: ${c.bold(spy.mock.calls.length)}\n`, |
| 1246 | ) |
| 1247 | return msg |
| 1248 | } |
| 1249 | |
| 1250 | function formatReturns( |
| 1251 | spy: MockInstance, |
no test coverage detected