(assertionErrors: any[])
| 44 | } |
| 45 | |
| 46 | export function resultAssertionsDiff(assertionErrors: any[]) { |
| 47 | if (!assertionErrors || assertionErrors.length === 0) { |
| 48 | return []; |
| 49 | } |
| 50 | const firstError = assertionErrors[0]; |
| 51 | |
| 52 | if (!firstError) { |
| 53 | return []; |
| 54 | } |
| 55 | |
| 56 | const formatValue = (value: any) => { |
| 57 | return (value && typeof value === 'object') ? JSON.stringify(value, null, 2) : String(value); |
| 58 | }; |
| 59 | |
| 60 | const expected = formatValue(firstError.expected); |
| 61 | const actual = formatValue(firstError.actual); |
| 62 | |
| 63 | return diff.diffLines(expected, actual); |
| 64 | } |
| 65 | |
| 66 | export function formatDiffText(assertionDiff: any[]): string|null { |
| 67 | const diffLines = |
no test coverage detected