Hi, I was happy to read the new features for Rails 5.1 here:
Specially as I have already been using webpack,npm and yarn for a while (well, yarn just recently, of course) and I'm pretty happy with the results. My main motivations were client-side performance improvements and source-maps support, but there were many more reasons I chose webpack as stated in the Goals section of this article:
As you can guess, I'm pretty happy with the direction Rails is taking as an opinionated system (even though I'm moving towards a discrete system I still see value in frameworks like Rails that are full featured and opinionated, specially for new or small-sized applications).
There's just one thing I found missing in this release notes and I don't want to sound critical. It's the other way around. As I said, I'm pretty happy with the direction Rails is taking, so this is a suggestion to improve it further if someone is interested on working or discussing this topic. I don't have time for that so if anyone is interested on making it happen feel free to disregard this suggestion.
I've been writing Single Page Applications since 2009 and even though I've tried testing them through solutions such as Capybara (and similar solutions for other languages such as Selenium) it doesn't really scale. At some point I completely dropped Capybara because I found that those specs were hardly executed since they were disabled by default because they were simply too slow.
I'm not saying adding Capybara to Rails was a bad idea. I do see value in it and I'm happy Rails adds it by default. I'm just saying that I feel like Rails isn't really aware of how SPA applications are developed in the wide. While browser tests allow you to test JavaScript they are not the only way. Using JavaScript test frameworks is what actually enable SPA testing to succeed. Since Rails 5.1 is supporting SPA I think it would be awesome if it also integrated some testing framework, maybe on top of Karma.js, for fulfilling that purpose and stablishing good practices just like it does for Ruby code.
https://karma-runner.github.io/1.0/index.html
Karma already exists for a while and looks like a mature solution to me, and could be integrated to several JavaScript frameworks, and tests can be run from the console, making it easier to integrate to CIs. Maybe Rails could adopt some well known framework such as Jasmine or Mocha for creating the stubs for new JS files.
Well, this is just an idea. I use my own JS test framework in our application, that's why I don't have a strong opinion on those test runners mentioned above, but I had some experience with them and they should be good enough for most applications.
Once again, thanks a lot for this 5.1 release. It seems like Rails is getting exciting again
Best,
Rodrigo.