-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Configure Cache Sweeper to Also Run in "test" Environment #151
Conversation
That comment is outdated. I disabled the sweeper in test because it slows down the suit of integration/system tests by quite a bit (from 5 to 7 minutes in our case if I remember) Propshaft loading before rspec shouldn’t be a problem since the loadpath only gets memoized on the first request. So there is something else going on here. |
You're totally right - I can see now where the problem was. So
Of course I did fix that by adding |
I think it should stay disabled by default, since it works fine and is faster. However if there is a use case for a config option to enable it, that cannot be solved in another way (like ensuring the build folder is committed) and enough interest from others (which my own PR #57 does not have), I’d welcome a PR. |
I totally get you - yes, that should stay disabled. My question was rather about - not filtering out these directories that don't exist during initialisation phase. |
I'm still a bit confused about your question. The line you pointed is not filtering out directories that do not exist. Instead, its telling propshaft that all folders named If a new directory (like So: If I'm not mistaken, the problem with |
Slightly different scenario
Result: Transpiled |
Ah, ok. I get it. Since My initial reaction is to say: just make sure the |
That's a tricky thing to implement. You can't add file watcher on something that does not exist. What about adding warning similar to this that you get when you precompile assets: "Warning: You are precompiling assets in development. Rails will not serve any changed assets until you delete public/assets/.manifest.json"? Let's say something like this:
|
I'm seriously considering having propshaft just create the |
Shouldn't this rather part of Rails project template? All these solutions - |
The builds folder is an implementation detail for the asset pipeline to better integrate with bundlers, so it doesn’t feel right that rails should know about it? But propshaft is the asset pipeline, and having it create the builds folder during boot provides the single plane as you mentioned. Also, the entire problem here is that people keep deleting said folder, so just creating it once (in the template) wouldn’t be enough. |
Seems to me that the bundler plugins should be adding app/javascript/builds/.keep when they're setup? |
Either way, this isn't the fix. |
Cache sweeper is not being used in "test" environment.
When using
dartsass-rails
- we're runningdartsass:build
before kicking off RSpec tests. However, we're doing that when RSpec is initializing - so after Propshaft is initialized. Whendartsass
creates files inassets/builds
- they're not picked up by Propshaft because cache sweeper is inactive in test.Looking at file
load_path
I can see this documentationWhich suggests that cache sweeper should be running in
test
environment. So this PR is updatingrailtie.rb
and sets cache sweeper to run in test by default.