NAME

Test::CPAN::Health::Reporter::TAP - Render a health report as TAP output

SYNOPSIS

use Test::CPAN::Health::Reporter::TAP;

my $reporter = Test::CPAN::Health::Reporter::TAP->new;
print $reporter->render($report);

# Pipe into a harness:
# cpan-health --format=tap My-Dist | prove --stdin

DESCRIPTION

Produces TAP (Test Anything Protocol) output for a Test::CPAN::Health::Report. Each check becomes one TAP test line.

pass    -> ok N - name: summary
warn    -> ok N - name: summary # WARN
fail    -> not ok N - name: summary
error   -> not ok N - name: summary
skip    -> ok N # SKIP name: reason

The TAP plan (1..N) is printed first. Detail strings are emitted as TAP diagnostic lines (# detail). Overall score and status counts appear as diagnostics at the end.

LIMITATIONS

  • The warn status maps to ok ... # WARN. # WARN is not a standard TAP directive but is readable and does not break harnesses.

  • Hash characters (#) in check summaries are replaced with [#] to avoid confusing TAP parsers that treat # as starting a directive.

render

PURPOSE

Render a Report as a valid TAP document.

API SPECIFICATION

INPUT

report  Test::CPAN::Health::Report  required

OUTPUT

Scalar string: TAP output ending with a newline.

MESSAGES

Code  | Severity | Message                            | Resolution
------+----------+------------------------------------+---------------------
TAP01 | FATAL    | report must be a Report object     | Pass a Report instance

FORMAL SPECIFICATION

-- Z schema (placeholder) --
RenderOp
report : Report
tap!   : String
-------------------------------------------------------
tap! starts with "1.." ++ str(#results)
valid_tap(tap!)

SIDE EFFECTS

None.

USAGE EXAMPLE

print $reporter->render($report);

AUTHOR

Nigel Horne, <njh at nigelhorne.com>

LICENSE AND COPYRIGHT

Copyright (C) 2025-2026 Nigel Horne.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.