Dist::Zilla::Plugin::Test::DiagINC - Add Test::DiagINC to all .t files


version 0.002


    # in dist.ini


This Dist::Zilla plugin adds the following Test::DiagINC line to all .t files under the t/ directory:

    use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC';

It will be inserted before the first module loaded (without adding a line to preserve line numbering), excluding strict and warnings. This makes sure that it is loaded before Test::More, which Test::DiagINC requires.

For example, it will turn this:

    use 5.008001;
    use strict;
    use warnings;

    use Test::More;
    # etc.

Into this:

    use 5.008001;
    use strict;
    use warnings;

    use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC'; use Test::More;
    # etc.


Prerequisite reporting modules like Dist::Zilla::Plugin::Test::ReportPrereqs and similar modules give an overview of prerequisites, but don't generally list deep dependencies — i.e. the modules used by the modules you use.

Dist::Zilla::Plugin::Test::PrereqsFromMeta offers a feature to report from %INC after loading all prerequisites, but it doesn't cover all types of dependencies and can't account for optional dependencies.

What I find most relevant is knowing exactly what modules are loaded when any given test fails. This would include test modules, optional modules and so on. It is specific to the failure situation.

That sort of output is also verbose, so this plugin only generates that output if $ENV{AUTOMATED_TESTING} is true. That means it will show up on CPAN Testers, but not clutter up manual test output, which seems to me like the right trade-off.


Bugs / Feature Requests

Please report any bugs or feature requests through the issue tracker at You will be notified automatically of any progress on your issue.

Source Code

This is open source software. The code repository is available for public review and contribution under the terms of the license.

  git clone


David Golden <>


This software is Copyright (c) 2014 by David Golden.

This is free software, licensed under:

  The Apache License, Version 2.0, January 2004