speeding-up-laravel-tests
Installation
SKILL.md
Speeding up Laravel tests
A curated list of techniques for making Laravel test suites faster. Apply these in roughly the order shown; environment fixes usually give the biggest wins for the least effort.
When to use
- Test suite takes more than a few seconds per test on average.
- CI duration is climbing and you want to knock minutes off.
- A specific test is slow and you want to audit what it is actually doing.
- You are onboarding a new project and want a standard checklist.
Environment and config
- Set
BCRYPT_ROUNDS=4in.env.testing(orphpunit.xml). Default is 12 and hashing dominates auth tests. - Disable XDebug. Disable pcov too at scale unless you specifically need coverage.
- Disable background packages in the testing environment: Pulse, Telescope, Nightwatch, and similar 3rd-party packages that do work on every request/command.
- Use
WithCachedConfigandWithCachedRoutestraits to avoid re-parsing config and routes on every test. - Call
withoutVite()(orwithoutMix()) in your test setup so the framework does not try to resolve built assets.