Test2::...ilOnFail(3)

πŸ“¦ version 1.302214, in opensuse-leap 16.0

πŸ’… Test2::Plugin::BailOnFail

okay so bestie, this is a page from the User Contributed Perl Documentation and it's literally the shortest little glow-up you've ever read. It's called Test2::Plugin::BailOnFail and it does exactly one thing, but it does it iconically.


✨ NAME ✨

Test2::Plugin::BailOnFail β€” Automatically bail out of testing on the first test failure.


πŸ›‘ DESCRIPTION πŸ›‘

So here's the tea: this module will issue a bailout event after the first test failure. That's it, that's the whole vibe.

This will prevent your tests from continuing. No more running 400 more tests after the one that already ate it β€” like, what's the point, honestly? 😭

The important little detail (and this is the part you gotta remember, no cap): the bailout runs when the context is released. Translating from nerd: it will run when the test function you are using, such as ok(), returns. That's on purpose, bestie β€” it gives the tools the chance to output any extra diagnostics they may need before everything shuts down. Giving the diagnostics their main character moment before the bailout. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

use Test2::V0;
use Test2::Plugin::BailOnFail;

ok(1, "pass");
ok(0, "fail");
ok(1, "Will not run");

Notice how that last ok(1, "Will not run") just… doesn't run? Yeah. That's the whole point. The ok(0, "fail") happens, the bailout kicks in when it's done, and the third one never gets its turn. It's giving cancelled. πŸ’€


πŸ”— SOURCE πŸ”—

The source code repository for Test2-Suite can be found at https://github.com/Test-More/test-more/.

Go be nosy, it's encouraged. πŸ‘€


πŸ‘‘ MAINTAINERS πŸ‘‘

  • Chad Granum <exodist@cpan.org>

🌸 AUTHORS 🌸

  • Chad Granum <exodist@cpan.org>

(yes it's the same person in both, and yes that's iconic of him, we love a consistent legend ✨)


Copyright Chad Granum <exodist@cpan.org>.

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/


πŸ’œ fr fr that's the entire page, it's tiny but mighty, and now you know it. go forth and bail on your first failure like a queen. πŸ¦‹

perl v5.42.0 Β· 2025-07-28 β€” mwah, that's the version and date, catch you on the next page bestie πŸ˜˜πŸŽ€

πŸ“¦ where this page comes from