(data: ScreenshotDiffResult)
| 306 | } |
| 307 | |
| 308 | export function formatScreenshotDiffText(data: ScreenshotDiffResult): string { |
| 309 | const useColor = supportsColor(); |
| 310 | const match = data.match === true; |
| 311 | const dimensionMismatch = data.dimensionMismatch; |
| 312 | |
| 313 | const lines: string[] = []; |
| 314 | lines.push(...formatScreenshotDiffStatusLines(data, useColor)); |
| 315 | lines.push(...formatScreenshotDiffArtifactLines(data, match, useColor)); |
| 316 | |
| 317 | if (!match && !dimensionMismatch) { |
| 318 | lines.push(...formatScreenshotDiffPixelCountLines(data, useColor)); |
| 319 | lines.push(...formatScreenshotDiffHintLines(data, useColor)); |
| 320 | lines.push(...formatScreenshotDiffRegionLines(data, useColor)); |
| 321 | lines.push(...formatScreenshotDiffOcrLines(data, useColor)); |
| 322 | lines.push(...formatScreenshotDiffNonTextLines(data, useColor)); |
| 323 | } |
| 324 | |
| 325 | return `${lines.join('\n')}\n`; |
| 326 | } |
| 327 | |
| 328 | function formatScreenshotDiffStatusLines(data: ScreenshotDiffResult, useColor: boolean): string[] { |
| 329 | if (data.match === true) { |
no test coverage detected