Subject: | BIzzare edgecase in test code causes misleading backtrace |
t/tester-demo.t appears to get a bit confused if test_dzil() fails for
some reason.
The backstory:
I had String::RewritePrefix 0.003, but 0.005 is a runtime-detected
requirement of Dist::Zilla::Role::PluginBundle::Easy. This causes dzil to
fail with an appropriate backtrace. However, that backtrace is hidden
by test_dzil() and stored in $result->error. (this output should be
checked, and for this, see the attached trivial patch).
The visible backtrace produced from prove began with:
couldn't load plugin @RJBS given in config: Can't locate
Dist/Zilla/PluginBundle/RJBS.pm in @INC
which is, of course, a huge WTF because the test code shouldn't be
trying to use [@RJBS]. This die occurs during:
ok(
(grep { $_ eq '[DZ] writing archive to DZ1-0.001.tar.gz' }
@{ $result->log_messages }),
"we logged the archive-creation",
);
So, my assumption is that $result is left in a wacky state by
test_dzil() when failure occurs due to missing prereqs, causing
->log_messages to instantiate some part of Dist::Zilla that involves
reading dist.ini from the current directory, pulling in
Dist-Zilla/dist.ini and thus seeing @RJBS.
Feel free to ignore this report if it's too crazy to consider fixing.
Subject: | check-test-dzil-output-for-errors.diff |
diff --git a/t/tester-demo.t b/t/tester-demo.t
index 0c3cac5..52d4bc0 100644
--- a/t/tester-demo.t
+++ b/t/tester-demo.t
@@ -10,7 +10,7 @@ use Test::DZil;
## SIMPLE TEST WITH DZIL::APP TESTER
my $result = test_dzil('corpus/DZ1', [ qw(build) ]);
-
+is($result->error, undef, 'No errors');
is($result->exit_code, 0, "dzil would have exited 0");
ok(