diff --git a/tests/Feature/StylesheetsTest.php b/tests/Feature/StylesheetsTest.php index 82e51dc4..ab086f55 100644 --- a/tests/Feature/StylesheetsTest.php +++ b/tests/Feature/StylesheetsTest.php @@ -3,6 +3,7 @@ use Illuminate\Support\Collection; use Illuminate\Support\Facades\File; use NoNameWeb\LivewireMaterial\Support\Layout; +use NoNameWeb\LivewireMaterial\Support\Stylesheets; use NoNameWeb\LivewireMaterial\Testing\DesignGuard; /** @@ -772,3 +773,19 @@ it('shapes showcase.css like a package stylesheet, with its documented unlayered } } }); + +it('keeps all.css under a gzip size budget, measured through Stylesheets::bundle()', function () { + // 106,838 bytes gzipped today (2026-09-15), rounded up by about 10% to a number CI can hold + // to without Node: PHP's own gzencode() on the same bytes Stylesheets::bundle() serves the + // showcase and the error page's fallback. A little organic growth should not retrigger this + // on every commit; a real jump means look at what grew since the budget was last raised. + $budget = 120_000; + + $gzipped = strlen((string) gzencode(Stylesheets::bundle([stylesheetPath('all.css')]), 9)); + + expect($gzipped)->toBeLessThanOrEqual($budget, sprintf( + 'all.css now gzips to %s bytes, over the %s-byte budget — see what grew, and raise the budget deliberately if it should have.', + number_format($gzipped), + number_format($budget), + )); +});