( errors: ConsoleEntry[], warnings: ConsoleEntry[], contrastFailures: ContrastEntry[], contrastPassed: ContrastEntry[], )
| 351 | } |
| 352 | |
| 353 | function emitTextReport( |
| 354 | errors: ConsoleEntry[], |
| 355 | warnings: ConsoleEntry[], |
| 356 | contrastFailures: ContrastEntry[], |
| 357 | contrastPassed: ContrastEntry[], |
| 358 | ): void { |
| 359 | const hasIssues = errors.length > 0 || warnings.length > 0 || contrastFailures.length > 0; |
| 360 | if (!hasIssues) { |
| 361 | const suffix = |
| 362 | contrastPassed.length > 0 ? ` · ${contrastPassed.length} text elements pass WCAG AA` : ""; |
| 363 | console.log(`${c.success("◇")} No console errors${suffix}`); |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | console.log(); |
| 368 | for (const e of errors) console.log(formatConsoleEntry(c.error("✗"), e)); |
| 369 | for (const w of warnings) console.log(formatConsoleEntry(c.warn("⚠"), w)); |
| 370 | if (contrastFailures.length > 0) printContrastFailures(contrastFailures); |
| 371 | |
| 372 | console.log(); |
| 373 | console.log(`${c.accent("◇")} ${formatTotals(errors, warnings, contrastFailures)}`); |
| 374 | } |
| 375 | |
| 376 | function emitFailureReport(message: string, asJson: boolean): void { |
| 377 | if (asJson) { |
no test coverage detected