(
result: { errors: ConsoleEntry[]; warnings: ConsoleEntry[]; contrast?: ContrastEntry[] },
asJson: boolean,
)
| 431 | }); |
| 432 | |
| 433 | function printValidationResult( |
| 434 | result: { errors: ConsoleEntry[]; warnings: ConsoleEntry[]; contrast?: ContrastEntry[] }, |
| 435 | asJson: boolean, |
| 436 | ): number { |
| 437 | const { errors, warnings, contrast } = result; |
| 438 | const contrastFailures = (contrast ?? []).filter((e) => !e.wcagAA); |
| 439 | const contrastPassed = (contrast ?? []).filter((e) => e.wcagAA); |
| 440 | |
| 441 | if (asJson) { |
| 442 | emitJsonReport(errors, warnings, contrast, contrastFailures); |
| 443 | } else { |
| 444 | emitTextReport(errors, warnings, contrastFailures, contrastPassed); |
| 445 | } |
| 446 | return errors.length > 0 ? 1 : 0; |
| 447 | } |
no test coverage detected