๐ ๐ง๐ฒ๐๐ ๐๐ผ๐ฟ ๐๐ถ๐ฑ๐ฑ๐ฒ๐ป ๐๐๐ด๐
Some bugs pass every test. Then they crash for your user. I found one in a Laravel admin UI. The fix was not a name change. The fix was a better test.
Flux uses Heroicons. I used Lucide names by mistake. My feature tests returned a 200 status. They passed. But the UI crashed.
Headless tests skip icon resolution. They treat icons as no-ops. The crash only happens during a full boot. Your automated tests miss this.
I wrote a Pest test to stop this. It reads the Blade view. It finds every icon name. It checks if the icon file exists in the vendor folder.
Why this works:
- It uses the source of truth.
- It finds dynamic icons.
- It tells you why it failed.
A guard test turns a production crash into a CI failure. This is where you want it.
Not every typo needs a test. Use this pattern when your runtime lies to you. Use it when components become no-ops. Use it when the environment differs from production.
If your tests run headless but production runs a full boot, do not chase the full boot in CI. Use a static check on source files. It is faster. It is cheaper. It works.
Source: https://dev.to/nasrulhazim/a-test-that-catches-the-bug-your-feature-tests-cant-see-44da