Under the hood, Devel::Cover will chdir to the -dir given as an option, if one is given.
This breaks any test that assumes that it is being run from the root of a distro, for example by writing something like use lib 't/lib'. Even worse, you cannot fix this by using FindBin and use lib "$Bin/lib", because FindBin blows up when it cannot resolve $0.
You can work around this by passing a fully qualified path to prove, but that's silly.
I think it'd be best if Devel::Cover did not change the working directory of the code it executes. That's a fairly intrusive thing to do, and I think ideally coverage testing should work just like non-coverage testing.
That said, I have no idea how much work changing this might be.
Under the hood,
Devel::Cover
willchdir
to the-dir
given as an option, if one is given.This breaks any test that assumes that it is being run from the root of a distro, for example by writing something like
use lib 't/lib'
. Even worse, you cannot fix this by usingFindBin
anduse lib "$Bin/lib"
, becauseFindBin
blows up when it cannot resolve$0
.You can work around this by passing a fully qualified path to
prove
, but that's silly.I think it'd be best if
Devel::Cover
did not change the working directory of the code it executes. That's a fairly intrusive thing to do, and I think ideally coverage testing should work just like non-coverage testing.That said, I have no idea how much work changing this might be.