pestphp/pest-plugin-global-assertions
A Pest plugin that adds global assertion helpers like assertTrue(), assertEquals(), and assertSame() to your test suite, bringing familiar PHPUnit-style assertion functions to Pest tests without extra imports or setup.
tests/Pest.php becomes globally callable without uses(SomeTrait::class) boilerplate in every file of a monorepo.toBeRefundable, toBeWithinDays(14), toAllBePublished) is a product decision about how legible and reviewable our specification of business rules is to non-authors — QA, analysts, and new engineers — not a code-style preference.require-dev, reversible in an afternoon), so it should be framed as a measured experiment with a defined success bar and exit path, not a platform commitment.Consider it only when:
require-dev, piloted in one non-critical module, with the exit path documented before the pilot begins.Money is formatted de_DE"), not one-file conveniences.Look elsewhere when:
expect()->extend() plus a shared file loaded from tests/Pest.php already covers the need. This is the most common reason to say no — core expectation extensions solve most "custom assertion" requirements with no extra dependency, and the pitch must be explicitly better than this baseline.TestCase or trait is idiomatic, and there's no Pest migration to justify the fit.RefreshDatabase, pest --parallel) are unverified and you can't absorb a compatibility spike.To executives: This is a development-only, MIT-licensed micro-plugin that lets us define a custom test assertion once and reuse it everywhere. It carries no production risk — nothing ships to customers, there's no runtime footprint, and it can be removed in an afternoon. The upside is less duplicated test code and tests that read in business language; the downside is that it's a very small, very young project with single-digit stars and zero downstream dependents. Frame it as a low-stakes, reversible experiment sized accordingly, with an explicit success bar: reduced duplicated assertion code, clearer tests, and surviving at least one Pest upgrade without blocking the team.
To engineering: Adopt only if we have a genuine library of shared domain assertions and want them globally callable without uses() boilerplate. Be honest about the overlap — expect()->extend() already solves most of this, so the justification must be "we have many assertions and want them callable without chaining or trait imports," not "custom assertions are nice." Before adoption: read the registration class in vendor/ as the de facto documentation (the README doesn't fully describe registration, $this binding, or the return contract), confirm Pest-major and PHPUnit compatibility, pin the version, and verify behavior under parallel testing. Then pilot in one non-critical module for a sprint, compare against the expect()->extend() + bootstrap alternative on the same measurements (duplicated helpers eliminated, files touched, reviewer comments attributable to test noise), and decide to standardize, vendor the MIT code, or fold the assertions back into a local trait. Assign an internal owner to track Pest upgrades so an abandoned dev dependency never becomes the thing that blocks a framework migration.
How can I help you explore Laravel packages today?