Test::DiagINC(3)
πΈ NAME πΈ
okay so this is Test::DiagINC(3) from the User Contributed Perl Documentation, and it is exactly the module you want when you need to List modules and versions loaded if tests fail. no cap.
β¨ VERSION β¨
version 0.010 β thatβs the vibe.
π¦ SYNOPSIS π¦
# preferably load before anything else
use if $ENV{AUTOMATED_TESTING}, 'Test::DiagINC';
use Test::More;
π DESCRIPTION π
Okay so picture this: you shipped your module to CPAN with working tests, but CPAN Testers (<http://www.cpantesters.org/>) failures show up. They might be due to platform issues, Perl version issues, or problems with dependencies. This module is your deep-dependency diagnostic bestie: it shows you exactly what modules and versions were loaded during a test run.
When this module is loaded, it sets up an END block that will take action if the program is about to exit with a non-zero exit code or if $test_builder->is_passing is false by the time the END block is reached. If that happens, this module prints out the names and version numbers of non-local modules appearing in %INC at the end of the test.
For example:
$ perl -MTest::DiagINC -MTest::More -e 'fail("meh"); done_testing'
not ok 1 - meh
# Failed test 'meh'
# at -e line 1.
1..1
# Looks like you failed 1 test of 1.
# Listing modules and versions from %INC
# 5.018002 Config
# 5.68 Exporter
# 5.68 Exporter::Heavy
# 1.07 PerlIO
# 0.98 Test::Builder
# 0.98 Test::Builder::Module
# 0.003 Test::DiagINC
# 0.98 Test::More
# 1.22 overload
# 0.02 overloading
# 1.07 strict
# 1.03 vars
# 1.18 warnings
# 1.02 warnings::register
This module deliberately does not load any other modules during runtime β it delays all loads until it needs to generate a failure report in its END block. The only exception is loading strict and warnings for self-check if and only if RELEASE_TESTING is true. So an empty invocation looks like this:
$ perl -MTest::DiagINC -e 'exit(1)'
# Listing modules from %INC
# 0.003 Test::DiagINC
NOTE: Because this module uses anENDblock, it is a good idea to load it as early as possible, so theENDblock it installs will execute as late as possible (seeperlmodfor details on how this works). While this module does employ some cleverness to work around load order, it is still a heuristic and is no substitute for loading this module early. A notable side-effect is when a module is loaded in anENDblock executing after the one installed by this library: such modules will be βinvisibleβ to us and will not be reported as part of the diagnostic report.
Modules that appear to be sourced from below the current directory when Test::DiagINC was loaded will be excluded from the report (e.g. excludes local modules from "./", "lib/", "t/lib", and so on).
The heuristic of searching %INC for loaded modules may fail if the module path loaded does not map to a package within the module file.
If Test::More is loaded, the output will go via the diag function. Otherwise, it will just be sent to STDERR.
π«Ά SUPPORT π«Ά
π Bugs / Feature Requests π
Please report any bugs or feature requests through the issue tracker at <https://github.com/dagolden/Test-DiagINC/issues>. 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.
<https://github.com/dagolden/Test-DiagINC>
git clone https://github.com/dagolden/Test-DiagINC.git
π AUTHOR π
David Golden <dagolden@cpan.org>
π CONTRIBUTORS π
Graham Knop <haarg@haarg.org>Peter Rabbitson <ribasushi@cpan.org>Roy Ivy III <rivy.dev@gmail.com>
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2014 by David Golden.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
π okay thatβs the whole manual, bestie. Cute sign-off: Test::DiagINC(3) from perl v5.42.0, dated 2022-07-18. Byeee! π
β¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-Test-DiagINC 0.010-bp160.1.11 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms