Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testcover only works with Test::Harness, not TAP::Harness #62

Open
mephinet opened this issue Nov 15, 2015 · 0 comments
Open

testcover only works with Test::Harness, not TAP::Harness #62

mephinet opened this issue Nov 15, 2015 · 0 comments

Comments

@mephinet
Copy link
Contributor

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::switches will be overwritten in run_test_harness, so setting it here has no effect whatsoever.
  • HARNESS_PERL_SWITCHES is only valued by Test::Harness, but not TAP::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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant