-
Notifications
You must be signed in to change notification settings - Fork 759
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
Loading .js.jsx files doesn't work in specs anymore #431
Comments
This line is probably why it stopped working: v1.4.1...v1.4.2#diff-db79e062f0a40ceaca64834c6738ee2bR7. Maybe the problem is in |
Thanks for all the info! It seems like adding support for sprockets 3 also introduced some bugs in other contexts. See also #415 and #423 I think the first step will be to add some failing specs for these cases (maybe need a new Gemfile for appraisal) then fix the bug itself. I'm working on #430 at the moment but I'll take a look at these sprockets issues next, if nobody gets to them before me! |
@rmosolgo I thought this was an issue with Sprockets so dug in trying to understand it. I didn't solve it, but wrote up what I found in rails/sprockets#209. Maybe that'll help? Also, if you have any pointers, maybe I'll be able to make some progress. |
Thanks for the update @mikem! |
Wow, thanks for that write-up! A great place to start with react-rails would be to write a failing test. Since I don't really understand the bug yet, I can't give a great suggestion, but I could imagine a few possibilities:
If we had a failing test, that could focus the work toward fixing it! |
I finally had some time to put a failing test together. @rmosolgo check out commit b962dae on my fork. |
See the following issues: - testdouble#178 - rails/sprockets#209 - reactjs/react-rails#431
While hunting down a bug in https://github.com/rmosolgo/react-rails-hot-loader, I discovered a behavior change between Sprockets 2 and Sprockets 3. In Sprockets 3: assets["my_component.js.jsx"] # => "raw" JSX
assets["my_component.js"] # => transformed JavaScript So, what if you try requiring those assets without the |
@rmosolgo yes, I've encountered that as well. Do you know whether that's a documented change of behavior in Sprockets? In my case it's another gem which is calling I'll mention this in testdouble/jasmine-rails#178. |
I was about to complain that it wasn't, but I figured I should check the upgrade notes again. Technically it is, it's here, under "We can request the file under its original content type". Makes sense, it's a change to support source maps. |
It sounds like this is a bug in jasmine-rails + sprockets 3, please reopen if there's something we should do in react-rails! |
I updated to react-rails 1.8.0 today in conjunction with the following and am no longer facing this issue:
Prior to that, I was holding at react-rails 1.4; this no longer seems necessary. |
Hey folks,
it looks like there is a little something weird, I am not 100% clear of what it is right now, but here is what I have: I am trying to use
TestUtils
, I am able to load it perfectly fine in a spec, withjasmine-rails
BUT, when I try to use it with code that requires JSX, and change the extension of the spec to.js.jsx
, it fails. It is new in 1.4.2, it works in 1.4.1.I've logged some of my findings in testdouble/jasmine-rails#178, if that can help.
This blog post explains how to do it, and has working code: http://www.calebwoods.com/2015/11/01/testing-react-components-rails/ (example code: https://github.com/calebwoods/react_testing) but it breaks when upgrading to react-rails 1.4.2, see the diff I just created to make sure only react-rails changed here calebwoods/react_testing@master...jipiboily:figure-out-wtf-breaks-it
I know this is issue is not 100% clear, as it's just not clear to me what broke, besides that everything seems to point to a change in v1.4.1...v1.4.2
And it still affects 1.5.0 from my quick test.
Any idea? I am going to use 1.4.1 in the meantime but happy to help on that if I can.
The text was updated successfully, but these errors were encountered: