PROVE(1)

๐Ÿ’… PROVE(1) โ€” a total slay of a rewrite ๐ŸŽ€

okay bestie, so this is prove from the Perl Programmers Reference Guide, and it's literally the main character of TAP harnesses. no cap, it runs your tests and tells you what's giving. let's get into it ๐Ÿ’–


โœจ NAME โœจ

prove โ€” run tests through a TAP harness. that's it. that's the vibe. ๐Ÿฆ‹


๐ŸŒธ USAGE ๐ŸŒธ

prove [options] [files or directories]

you hand it files or directories, it runs the tests. iconic. ๐Ÿ‘‘


๐Ÿ’… OPTIONS ๐Ÿ’…

๐Ÿงš Boolean options (the on/off girlies) โ€” they're just flags, no argument needed

  • -v, --verbose โ€” print, like, all the test lines. also sets TEST_VERBOSE. she's chatty ๐Ÿ’ฌ
  • -l, --lib โ€” add 'lib' to the path for your tests, aka -Ilib. lowkey essential.
  • -b, --blib โ€” add blib/lib and blib/arch to the path for your tests. both of them. periodt.
  • -s, --shuffle โ€” run the tests in random order. chaos energy, but make it a feature ๐ŸŽฒ
  • -c, --color โ€” colored test output. this is the default, bestie โ€” color is already the moment ๐ŸŒˆ
  • --nocolor โ€” do not color the test output. for when you want it plain, I guess ๐Ÿ™ˆ
  • --count โ€” show the X/Y test count when not verbose. this is the default too, so you're already getting it.
  • --nocount โ€” disable the X/Y test count. turn it off if you must ๐Ÿ’€
  • -D, --dry โ€” dry run. shows the tests that would have run. all the dress rehearsal, none of the actual running ๐ŸŽฌ
  • -f, --failures โ€” show the failed tests. the callout list, fr fr
  • -o, --comments โ€” show comments. give the people the commentary ๐Ÿ—ฃ๏ธ
  • --ignore-exit โ€” ignore the exit status from test scripts. pretend you didn't see it ๐Ÿ‘€
  • -m, --merge โ€” merge test scripts' STDERR with their STDOUT. two streams, one vibe ๐ŸŒŠ
  • -r, --recurse โ€” recursively descend into directories. she goes deeper ๐ŸŒ€
  • --reverse โ€” run the tests in reverse order. backwards but make it fashion ๐Ÿ’ซ
  • -q, --quiet โ€” suppress some test output while running tests. shhh, she's focusing ๐Ÿคซ
  • -Q, --QUIET โ€” only print summary results. the absolute bare minimum, and honestly? valid.
  • -p, --parse โ€” show the full list of TAP parse errors, if there are any. receipts, gathered ๐Ÿงพ
  • --directives โ€” only show results that have TODO or SKIP directives. filtered and fabulous โœจ
  • --timer โ€” print elapsed time after each test. clock it โฑ๏ธ
  • --trap โ€” trap Ctrl+C and print a summary on interrupt. she catches you before you go ๐Ÿซถ
  • --normalize โ€” normalize TAP output in verbose output. neat and tidy ๐ŸŽ€
  • -T โ€” enable tainting checks. spicy ๐ŸŒถ๏ธ
  • -t โ€” enable tainting warnings. spicy but warning flavor
  • -W โ€” enable fatal warnings. warnings that end you ๐Ÿ˜ญ
  • -w โ€” enable warnings. the regular ones, no fatality
  • -h, --help โ€” display this help. your girl, always ๐Ÿ™Œ
  • -? โ€” display this help. same energy, different key
  • -V, --version โ€” display the version. know your era ๐Ÿท๏ธ
  • -H, --man โ€” the longer manpage for prove. the director's cut ๐ŸŽฅ
  • --norc โ€” don't process the default .proverc. skip the pregame ๐Ÿšซ

๐Ÿ“ Options that take arguments (these ones want a lil snack)

  • -I โ€” library paths to include. give her the locations ๐Ÿ“š
  • -P โ€” load a plugin. she searches App::Prove::Plugin::*. plug in, glow up ๐Ÿ”Œ
  • -M โ€” load a module. just, like, bring a module along ๐ŸŽ’
  • -e, --exec โ€” the interpreter to run the tests with. '' (empty string) is for compiled tests, fyi ๐Ÿ‘€
  • --ext โ€” set the extension for tests. default is '.t'. tiny but mighty.
  • --harness โ€” define the test harness to use. see TAP::Harness. pick your fighter ๐ŸฅŠ
  • --formatter โ€” the result formatter to use. see FORMATTERS. aesthetics matter ๐Ÿ’…
  • --source โ€” load and/or configure a SourceHandler. see SOURCE HANDLERS. sourcing the source, iykyk ๐Ÿงš
  • -a, --archive _out.tgz_ โ€” store the resulting TAP in an archive file. save it for the group chat ๐Ÿ“ฆ
  • -j, --jobs _N_ โ€” run N test jobs in parallel. the page literally suggests try 9. nine. go off ๐Ÿ”ฅ
  • **--state=_opts_ โ€” control prove's persistent state. she remembers things about you.๐Ÿ’€
  • **--statefile=_file_ โ€” use file instead of .prove for state. rename your memory file, iconique
  • *--rc=_rcfile_ โ€” process options from *rcfile. your own personal pregame file ๐ŸŽ€
  • --rules โ€” rules for parallel vs sequential processing. who runs together and who runs solo, the whole social dynamic ๐ŸŒˆ

that's part one, bestie โ€” the plot thickens in part two, so don't go anywhere ๐Ÿซถโœจ


๐Ÿ“ NOTES (the fine print, but make it cute)

๐Ÿ—‚๏ธ .proverc

So if ~/.proverc or ./.proverc exist, bestie, they get read and every option inside them gets processed before your command line options. And you write options in .proverc exactly the same way you'd write them on the command line:

# .proverc
--state=hot,fast,save
-j9

You can also point at extra option files with the --rc option. And if you want to shut off the default option-file processing entirely, that's --norc.

Heads up for the Windows and VMS girlies: the option file is named _proverc instead of .proverc, and it's only looked for in the current directory. ๐Ÿ’…

๐Ÿ“ฅ Reading from STDIN

Got a whole list of tests (or URLs, or literally anything you want to test) sitting in a file? Just yeet a - in there and it'll add them to your tests:

prove - < my_list_of_things_to_test.txt

See the README in the examples directory of this distribution for more. ๐Ÿซถ

๐Ÿ“ Default Test Directory

No files or directories supplied? No problem. prove goes looking for everything matching the pattern t/*.t. Iconic default behavior, honestly.

๐ŸŒˆ Colored Test Output

Colored test output via TAP::Formatter::Color is the default, but if output isn't going to a terminal, color is disabled. Want to force it anyway? Add the --color switch, slay.

Color support requires Term::ANSIColor and โ€” on windows platforms โ€” also Win32::Console::ANSI. If the necessary module(s) aren't installed, colored output just won't be available. ๐Ÿ˜ญ

๐Ÿšฆ Exit Code

If the tests fail, prove exits with non-zero status. Simple as that, no cap.

๐ŸŽฏ Arguments to Tests

Yes, you can absolutely pass arguments to your tests. Just separate them from prove's own arguments with the arisdottle, ::. Like:

prove -v t/mytest.t :: --url http://example.com

That would run t/mytest.t with the options --url http://example.com. And when you're running multiple tests, they each receive the same arguments. โœจ

๐Ÿƒ --exec

Normally you just hand over a list of Perl tests and the harness knows how to execute them. But if your tests aren't written in Perl, or you want every test invoked exactly the same way, use the -e, or --exec switch:

prove --exec '/usr/bin/ruby -w' t/
prove --exec '/usr/bin/perl -Tw -mstrict -Ilib' t/
prove --exec '/path/to/my/customer/exec'

๐Ÿ”€ --merge

Need to make sure your diagnostics show up in the correct order relative to test results? Use --merge to merge the test scripts' STDERR into their STDOUT.

This guarantees that STDOUT (where the test results appear) and STDERR (where the diagnostics appear) stay in sync. The harness will display any diagnostics your tests emit on STDERR. ๐Ÿฆ‹

โš ๏ธ Caveat, and I mean it: this is a bit of a kludge. In particular, note that if anything that appears on STDERR looks like a test result, the test harness will get confused. Use this option only if you understand the consequences and can live with the risk. ๐Ÿ’€

๐Ÿชค --trap

The --trap option will attempt to trap SIGINT (Ctrl+C) during a test run and display the test summary even if the run is interrupted. So polite, honestly. ๐ŸŽ€

๐Ÿ’พ --state

Okay this one's a whole vibe. You can ask prove to remember the state of previous test runs, and then select and/or order the tests to be run based on that saved state.

The --state switch requires an argument, and that argument must be a comma separated list of one or more of the following options:

"last"

Run the same tests as the last time the state was saved. This makes it possible, for example, to recreate the ordering of a shuffled test. ๐ŸŒธ

# Run all tests in random order
$ prove -b --state=save --shuffle

# Run them again in the same order
$ prove -b --state=last

"failed"

Run only the tests that failed on the last run.

# Run all tests
$ prove -b --state=save

# Run failures
$ prove -b --state=failed

And if you also specify the save option, newly passing tests will be excluded from subsequent runs:

# Repeat until no more failures
$ prove -b --state=failed,save

"passed"

Run only the passed tests from last time. Useful to make sure no new problems have been introduced. ๐Ÿ‘‘

"all"

Run all tests in normal order. You can specify multiple options, so to run all tests with the failures from last time first:

$ prove -b --state=failed,all,save

"hot"

Run the tests that most recently failed first. The last failure time of each test is stored, and the hot option causes tests to be run in most-recent-failure order. ๐Ÿ”ฅ

$ prove -b --state=hot,save

Tests that have never failed will not be selected. To run all tests with the most recently failed first, use:

$ prove -b --state=hot,all,save

This combination of options may also be specified thus:

$ prove -b --state=adrian

"todo"

Run any tests with todos. ๐Ÿ“‹

"slow"

Run the tests in slowest to fastest order. This is useful in conjunction with the -j parallel testing switch, to ensure that your slowest tests start running first.

$ prove -b --state=slow -j9

"fast"

Run test tests in fastest to slowest order. (Yes, "test tests", that's what it says, we keep the lore intact. ๐ŸŒ)

"new"

Run the tests in newest to oldest order, based on the modification times of the test scripts.

"old"

Run the tests in oldest to newest order.

"fresh"

Run those test scripts that have been modified since the last test run. โœจ

"save"

Save the state on exit. The state is stored in a file called .prove (_prove on Windows and VMS) in the current directory.

And yes, the --state switch may be used more than once:

$ prove -b --state=hot --state=all,save

๐Ÿ“ --rules

The --rules option controls which tests run sequentially and which run in parallel โ€” but only if the --jobs option is specified. You can specify this option multiple times, and the order matters. ๐Ÿ’…

The most practical use is probably to declare that some tests are not "parallel-ready". And since mentioning a file with --rules doesn't cause it to be selected to run as a test, you can "set and forget" some rules preferences in your .proverc file. Then you'll be able to take maximum advantage of the performance benefits of parallel testing, while some exceptions are still run in parallel.

--rules examples

# All tests are allowed to run in parallel, except those starting with "p"
--rules='seq=t/p*.t' --rules='par=**'

# All tests must run in sequence except those starting with "p", which should be run parallel
--rules='par=t/p*.t'

--rules resolution

  • By default, all tests are eligible to be run in parallel. Specifying any of your own rules removes this one.
  • "First match wins". The first rule that matches a test will be the one that applies.
  • Any test which does not match a rule will be run in sequence at the end of the run.
  • The existence of a rule does not imply selecting a test. You must still specify the tests to run.
  • Specifying a rule to allow tests to run in parallel does not make them run in parallel. You still need specify the number of parallel "jobs" in your Harness object.

--rules Glob-style pattern matching

We implement our own glob-style pattern matching for --rules. Here are the supported patterns:

** is any number of characters, including /, within a pathname
* is zero or more characters within a filename/directory name
? is exactly one character within a filename/directory name
{foo,bar,baz} is any of foo, bar or baz.
\ is an escape character

More advanced specifications for parallel vs sequence run rules

If you need more advanced management of what runs in parallel vs in sequence, see the associated 'rules' documentation in TAP::Harness and TAP::Parser::Scheduler. And if what's possible directly through prove isn't sufficient, you can write your own harness to access these features directly. ๐Ÿ› ๏ธ

๐Ÿ“š @INC

prove introduces a separation between "options passed to the perl which runs prove" and "options passed to the perl which runs tests" โ€” and this distinction is by design. So the perl that's running a test starts with the default @INC. Additional library directories can be added via the PERL5LIB environment variable, via -Ifoo in PERL5OPT, or via the -Ilib option to prove. ๐Ÿงš

๐Ÿ›ก๏ธ Taint Mode

Normally, when a Perl program is run in taint mode, the contents of the PERL5LIB environment variable do not appear in @INC.

But because PERL5LIB is often used during testing to add build directories to @INC, prove passes the names of any directories found in PERL5LIB as -I switches. The net effect of this is that PERL5LIB is honoured even when prove is run in taint mode. โญ


๐ŸŽจ FORMATTERS

You can load a custom TAP::Parser::Formatter:

prove --formatter MyFormatter

๐Ÿ”Œ SOURCE HANDLERS

You can load custom TAP::Parser::SourceHandlers, to change the way the parser interprets particular sources of TAP.

prove --source MyHandler --source YetAnother t

And if you want to provide config to the source, you can use:

prove --source MyCustom \
      --source Perl --perl-option 'foo=bar baz' --perl-option avg=0.278 \
      --source File --file-option extensions=.txt --file-option extensions=.tmp t
      --source pgTAP --pgtap-option pset=format=html --pgtap-option pset=border=2

Each --$source-option option must specify a key/value pair separated by an =. If an option can take multiple values, just specify it multiple times, as with the extensions= examples above. And if the option should be a hash reference, specify the value as a second pair separated by an =, as in the pset= examples above (escape = with a backslash).

All --sources are combined into a hash, and passed to new in TAP::Harness's sources parameter. ๐Ÿซถ

See TAP::Parser::IteratorFactory for more details on how configuration is passed to SourceHandlers.

๐Ÿงฉ PLUGINS

Plugins can be loaded using the -Pplugin syntax, eg:

prove -PMyPlugin

This will search for a module named App::Prove::Plugin::MyPlugin, or failing that, MyPlugin. If the plugin can't be found, prove will complain & exit. ๐Ÿ˜ค

You can pass arguments to your plugin by appending =arg1,arg2,etc to the plugin name:

prove -PMyPlugin=fou,du,fafa

Please check individual plugin documentation for more details.

๐Ÿ›๏ธ Available Plugins

For an up-to-date list of plugins available, please check CPAN:

<https://metacpan.org/search?q=App%3A%3AProve+Plugin>

โœ๏ธ Writing Plugins

Please see "PLUGINS" in App::Prove.


And that's the whole page, bestie โ€” you made it to the end! ๐ŸŒˆ This gorgeous little masterpiece is from perl v5.42.3 and it's dated 2026-11-03, so go forth and prove literally everything. Mwah! ๐Ÿ’–

๐Ÿ“ฆ where this page comes from