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=4 in .env.testing (or phpunit.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 WithCachedConfig and WithCachedRoutes traits to avoid re-parsing config and routes on every test.
  • Call withoutVite() (or withoutMix()) in your test setup so the framework does not try to resolve built assets.
Related skills

More from freekmurze/dotfiles

Installs
10
GitHub Stars
945
First Seen
Apr 14, 2026