ralphjsmit/pest-plugin-filesystem
Pest plugin that adds expressive filesystem assertions to your test suite, so you can verify files and directories exist, contain expected content, or are empty without verbose PHP boilerplate. A small, focused helper for cleaner Pest tests.
file_exists(), file_get_contents()) into Pest's expect() API. The decision is not whether to invest in testing infrastructure; it's whether to take a dependency for roughly 30–100 lines of local helper code. The package is MIT-licensed, so even the "build" option can legitimately copy the approach.expect($path)->toBeFile() instead of scaffolding around file_exists(). The gain is real but modest and entirely a developer-experience gain.Storage::fake() and built-in filesystem assertions are the platform answer for storage-layer tests. This package is a readability add-on for tests that touch the real local filesystem, not a platform choice and not a budget line.Consider it when:
Storage::fake() disks.^1.2, committing the lockfile, and including dev dependencies in composer audit.Look elsewhere (or reimplement locally) when:
Storage::fake() and Laravel's built-in assertions — the marginal readability gain won't justify a new dependency.composer why-not may simply block resolution. That ends the evaluation cleanly.Recommended decision: a time-boxed trial inside the test suite only, gated on a version-resolution check and a spike that includes at least one assertion that must fail. If constraints don't resolve — the more likely outcome — write the handful of expectations locally in tests/Pest.php (adapting the MIT-licensed source if useful) and reach zero recurring dependency cost. Either way, resolve it at the next dependency review rather than carrying it indefinitely.
Executives: This is a small, MIT-licensed testing helper that makes filesystem-related tests shorter and easier to read for teams using Pest. It has no production runtime footprint — it executes only in test code, so an upstream stall or breaking change never touches customers. The cost of trying it is measured in hours. The trade-off is maturity: a handful of GitHub stars, a single maintainer, and a last release in early 2023. The recommendation is a contained trial, not a platform standard, with no budget ask and no roadmap impact. If it goes stale, we remove it or replace it with local helpers at a cost of roughly an afternoon.
Engineering: Treat this as a dev-only dependency with a documented exit plan. Pin ^1.2, commit the lockfile, and verify actual constraint resolution (composer why-not, composer.json for Pest/PHPUnit/PHP constraints and the extra.pest.plugins entry) rather than trusting the release notes. Spike in one throwaway test file covering file-exists, content-contains, path-missing, temp-directory creation and cleanup, plus at least one assertion that must fail — a helper that passes when it should fail is worse than no helper. Run the spike across the full CI matrix, including parallel mode and any non-Linux runner, since path handling and temp-file collisions are the likeliest failure points. Keep it off the production dependency path, include dev dependencies in composer audit, and prefer Storage::fake() wherever it already covers the case. Do not sweep-convert existing assertions — adopt for new tests only.
Product: A maintenance-phase, developer-experience call: modest upside in test readability and onboarding, negligible downside because it is isolated to test code and reversible. It should not consume roadmap capacity or gate a release. Revisit at the next dependency review; if there has still been no release or maintenance activity, drop it in favor of a local shim rather than carrying the dependency forward by default.
How can I help you explore Laravel packages today?