speeding-up-laravel-tests
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.
More from freekmurze/dotfiles
php-guidelines-from-spatie
Describes PHP and Laravel guidelines provided by Spatie. These rules result in more maintainable, and readable code.
145context7-auto-research
Automatically fetches up-to-date documentation from Context7 when users ask about libraries, frameworks, APIs, or need code examples. Triggers proactively without explicit user request.
28react-native-best-practices
Provides React Native performance optimization guidelines for FPS, TTI, bundle size, memory leaks, re-renders, and animations. Applies to tasks involving Hermes optimization, JS thread blocking, bridge overhead, FlashList, native modules, or debugging jank and frame drops.
24agent-browser
Automates browser interactions for web testing, form filling, screenshots, and data extraction. Use when the user needs to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.
24copy-editing
When the user wants to edit, review, or improve existing marketing copy. Also use when the user mentions 'edit this copy,' 'review my copy,' 'copy feedback,' 'proofread,' 'polish this,' 'make this better,' or 'copy sweep.' This skill provides a systematic approach to editing marketing copy through multiple focused passes.
24fix-github-issue
Fix GitHub issues using gh CLI. Use when asked to fix, resolve, or address a GitHub issue. Creates fixes on separate branches, runs tests locally, and creates PRs when tests pass. Requires gh CLI authenticated and repo cloned locally.
22