test: abort with a clear message when built assets are missing - #7204
Open
costajohnt wants to merge 1 commit into
Open
costajohnt wants to merge 1 commit into
costajohnt wants to merge 1 commit into
Conversation
costajohnt
requested review from
FireLemons,
compwron and
elasticspoon
as code owners
September 20, 2026 22:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What github issue is this PR for, if any?
Resolves #7100
What changed, and why?
On a fresh checkout,
app/assets/builds/is empty (it is gitignored and only populated bynpm run buildandnpm run build:css).manifest.jslinks that directory, andlink_directoryonly declares files that exist, so a layout that linkstailwind.cssraisesAssetNotPrecompiledErrorwith advice to edit the manifest, which is already correct. A missingapplication.jsfails with "not present in the asset pipeline".spec/rails_helper.rb: abort at boot when any of the three bundles the layouts link (application.js,all_casa_admin.js,tailwind.css) is missing, naming the commands that build them. Sits next to the existing pending-migration abort and follows the same pattern.README.md: note under Running Tests thatbin/rails specbuilds the bundles first (it runsspec:prepare, which jsbundling/cssbundling hook into), while a barebundle exec rspecdoes not.Two things from the issue that did not hold up:
config/environments/production.rb; the test environment still hasconfig.assets.compile = true. The cause is the missing build output, not on-demand compilation being off.npm run build:cssworks from a cleannpm cihere (arm64 macOS, Node 24.18, npm 11):@tailwindcss/cliand thetailwindcssbin are installed and the CSS is written. So I leftpackage.jsonalone.bin/setupalready runs both builds since #7051, so that part of the issue was done.How is this tested? (please write rspec and jest tests!) 💖💪
No spec: the guard runs while
rails_helperloads and aborts the process, and the repo has no precedent for subprocess specs. Checked by hand:bundle exec rspec spec/requests/case_court_reports_spec.rb:14:28:37with the bundles built: 3 examples, 0 failures.app/assets/builds/tailwind.cssremoved,bundle exec rspec spec/requests/case_court_reports_spec.rb:14exits 1 and printsMissing built assets: tailwind.css. Run \npm run build` and `npm run build:css`, or use `bin/rails spec`, which builds them.` before anything else.tailwind.cssremoved,bin/rails spec SPEC=...rebuilds it and passes, which is why the README wording distinguishes the two.bundle exec standardrb spec/rails_helper.rbclean.CI runs
rails assets:precompilebefore rspec, so the guard cannot fire there.Screenshots please :)
Terminal output with
tailwind.cssremoved: