Test2:...atcher(3pm)

πŸ’… Test2::Harness::Auditor::Watcher β€” the vibe check for one single test job

okay so bestie, this page is Test2:...atcher(3pm) β€” which is the manual entry for Test2::Harness::Auditor::Watcher, sitting in the User Contributed Perl Documentation corner of perl section 3pm. Yes, the title got clipped like a bad fringe. It's the Watcher. Let's go. πŸ¦‹


✨ NAME ✨

Test2::Harness::Auditor::Watcher β€” Class to monitor events for a single job and pass judgement on the result.

Like, it's literally the judge. Not the ✨judgy✨ kind, the actual kind that decides pass or fail.


🌸 DESCRIPTION 🌸

This module represents a per-job state tracker. That's the whole thing, and honestly? It ate.

This module sees every event and manages the state produced. Every. Single. One. It's giving surveillance but make it productive πŸ‘‘

In the end this tracker determines if a test job passed or failed, and why. The "and why" part is the main character energy here β€” it's not just vibes, it's receipts.


⭐ SYNOPSIS ⭐

use Test2::Harness::Auditor::Watcher;

my $watcher = Test2::Harness::Auditor::Watcher->new();

for my $event (@events) {
    $watcher->process($event);
}

print "Pass!" if $watcher->pass;
print "Fail!" if $watcher->fail;

look at that. feed it events, ask it for the tea at the end. slay. πŸ’–


πŸŽ€ METHODS πŸŽ€

okay here's the whole roster, no skips, I promise bestie 🫢

  • $int = $watcher->assertion_count() β€” Number of assertions that have been seen. Just counting them. Every last one. πŸ“ˆ
  • $exit = $watcher->exit() β€” If the job has exited this will return the exit value (integer, 0 or greater). If the job has not exited yet (or at least if the watcher has not seen the exit event yet) this will return undef. So undef = "don't know yet, hold on." πŸ•°οΈ
  • $bool = $watcher->fail() β€” Returns true if the job has failed/is failing. 😭
  • @error_facets = $watcher->fail_error_facet_list β€” Used internally to get a list of 'error' facets to inject into the harness_job_exit event. Internal business, iykyk.
  • $file = $watcher->file β€” If the test file is known this will return it (string). This will return undef if the file is not yet known. Mystery file era πŸ™ˆ
  • $string = $watcher->halt β€” If the test was halted (bail-out) this will contain the human readible reason. Yes, the test can just leave, and this is the note it left behind πŸ’€
  • $bool = $watcher->has_exit β€” Check if the exit value is known.
  • $bool = $watcher->has_plan β€” Check if a plan has been seen. Plans are iconic, we love a plan ✨
  • $job = $watcher->job β€” If the job is known this will return the detailed structure of the job.
  • $int = $watcher->nested β€” If this watcher represents a subtest this will be an integer greater than 0; the top-level test is 0. So 0 = main character, anything above 0 = the supporting cast 🎭
  • $hash = $watcher->numbers β€” This is an internal state tracking what test numbers have been seen. This is really only applicable in tests that produced TAP.
  • $bool = $watcher->pass β€” Check if the test job is passing. 🀞
  • $plan_facet = $watcher->plan() β€” If the plan facet has been seen this will return it.
  • $watcher->process($event); β€” Modify the state based on the provided event. This is the one you call in the loop, bestie. Every event. In order. Don't skip 🚨
  • $watcher->subtest_fail_error_facet_list β€” Used internally to get a list of 'error' facets to inject into the harness_job_exit event. The subtest-flavoured sibling of the one above.
  • $times = $watcher->times() β€” Retuns the Test2::Harness::Auditor::TimeTracker instance. (Typo's canon, we don't fix canon πŸ’…)
  • $int = $watcher->try() β€” Sometimes a job is run more than once, in those cases this will be an integer greater than 0 representing the try. 0 is used for the first try. Round one is always 0, king behavior πŸ‘‘

πŸ”₯ SOURCE πŸ”₯

The source code repository for Test2-Harness can be found at http://github.com/Test-More/Test2-Harness/


πŸ’œ MAINTAINERS πŸ’œ

Chad Granum <exodist@cpan.org>


🌈 AUTHORS 🌈

Chad Granum <exodist@cpan.org>


Copyright 2020 Chad Granum <exodist7@gmail.com>.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

See http://dev.perl.org/licenses/


aaaaand that's the whole page bestie, no cap, nothing skipped πŸŽ€ this was generated against perl v5.40.1 and dated 2026-05-10, and yeah the footer still says Test2:...atcher(3pm) because the title truncation is forever iconic πŸ’… mwah, go forth and watch some events πŸ¦‹

πŸ“¦ where this page comes from