Replies: 3 comments 1 reply
-
Your question is indeed relevant for Rails development, especially when transitioning from Webpacker to jsbundling-rails. The issue you're facing with RSpec and Capybara not automatically picking up changes in JavaScript files is a common one in this scenario. Here are a few suggestions and alternative approaches to consider: Understanding the Problem
Alternative Approaches
Addressing Your Specific Setup
While there might not be a perfect solution, exploring these alternatives and combinations thereof can lead to a more efficient and elegant setup for your Rails application testing environment. |
Beta Was this translation helpful? Give feedback.
-
Related #2675 |
Beta Was this translation helpful? Give feedback.
-
For the record RSpec does no compilation of assets directly, what ever behaviour exists is brought in from Rails test helpers, if theres something more we can bring in to get parity with MiniTest I'm happy to review a PR, but this could also be an ordering issue where something isn't being included in the right place |
Beta Was this translation helpful? Give feedback.
-
Hi community,
not sure if this is a good place to ask, but maybe you can point me to the right one if this isn't it.
I'm using jsbundling-rails in conjunction with capybara and ferrum for my system specs. I noticed that using this setup, changes to javascript are not compiled automatically when executing system specs, which is something that I was used to back when I was using webpacker.
I ended up putting this into my
rails_helper.rb
:Seemed like a straightforward solution, but it seems that rspec caches(?) the existing javascript on boot-up, so I have to execute it twice in order for the javascript to be up-to-date.
I ended up modifying my binstub to compile the js files before rspec even starts:
This works, but it's a little inelegant. Is there another way?
I'm curious if there is anyway to prevent rspec from caching the js files before I'm bundling them.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions