-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
The action testcover needs to set -MDevel::Cover when tests are executed, so that coverage metrics are collected. Currently, it tries to achieve this by these lines of code:
(https://github.com/Perl-Toolchain-Gang/Module-Build/blob/master/lib/Module/Build/Base.pm#L2805)
local $Test::Harness::switches =
local $Test::Harness::Switches =
local $ENV{HARNESS_PERL_SWITCHES} = "-MDevel::Cover";
This is broken in two ways:
Test::Harness::switcheswill be overwritten inrun_test_harness, so setting it here has no effect whatsoever.HARNESS_PERL_SWITCHESis only valued byTest::Harness, but notTAP::Harness.
The result is that testcover only works with Test::Harness:
$ rm -rf cover_db; ./Build testcover
...
Result: PASS
HTML output written to .../cover_db/coverage.html
but not in TAP::Harness:
$ rm -rf cover_db; ./Build testcover use_tap_harness=1
...
Result: PASS
Can't open database .../cover_db
IMHO, the correct way for testcover to work would be to add -MDevel::Cover to the harness_switches, as they are passed on correctly to both Test::Harness and TAP::Harness.
Seen on Gentoo Linux amd64, Perl 5.20.2 and Module::Build from git master, as well as 0.4214.
Metadata
Metadata
Assignees
Labels
No labels