Trouble mixing TAP::Harness constructor args

120 views Asked by At

It looks like some of the TAP::Harness (v3.23) constructor args don't like to play together.

When I try to specify the formatter arg along with verbosity or color args, the module complains about the latter two being unrecognized. When I comment it out, it works just fine. Am I doing something wrong?

use strict;
use warnings;

use TAP::Harness;
use TAP::Formatter::HTML;

print "TAP::Harness Version : $TAP::Harness::VERSION\n";  # 3.23

my $fmt = TAP::Formatter::HTML->new;
   $fmt->output_file( 'test.html' );

my $harness = TAP::Harness
                ->new( {
                         color       => 1,
                         verbosity   => -2,
                         formatter   => $fmt,
                         lib         => $^O =~ /win/i
                                        ? [ 'C:\\some\\lib' ]
                                        : [ '/usr/bin/etc/some/lib' ],
                     } );

OUTPUT (with formatter arg specified):

Unknown arguments to TAP::Harness::new (color verbosity) at harness.pl line 41
1

There are 1 answers

0
Zaid On BEST ANSWER

So it looks like TAP::Formatter::HTML has its own verbosity and color properties:

verbosity

$fmt->verbosity( [ $v ] )

Verbosity level, as defined in "new" in TAP::Harness:

1   verbose        Print individual test results (and more) to STDOUT.
 0   normal
-1   quiet          Suppress some test output (eg: test failures).
-2   really quiet   Suppress everything to STDOUT but the HTML report.
-3   silent         Suppress all output to STDOUT, including the HTML report.

color

This method is for TAP::Harness API compatibility only. It does nothing.


So the arguments need to be passed to the TAP::Formatter::HTML object and not the harness.